From d7dcb3c1fddcf16b12bfe64b6efaefedd99568a1 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Wed, 3 Aug 2016 22:52:19 -0700 Subject: [PATCH 1/2] Add a simple Jenkinsfile --- Jenkinsfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f7e1cf7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,27 @@ +node { + stage 'Clean workspace' + /* Running on a fresh Docker instance makes this redundant, but just in + * case the host isn't configured to give us a new Docker image for every + * build, make sure we clean things before we do anything + */ + deleteDir() + + + stage 'Checkout source' + checkout scm + + + stage 'Build and test' + /* if we can't install everything we need for Ruby in less than 15 minutes + * we might as well just give up + */ + timeout(30) { + sh './gradlew -iS' + } + + stage 'Capture test results and artifacts' + step([$class: 'JUnitResultArchiver', testResults: 'build/test-results/**/*.xml']) + step([$class: 'ArtifactArchiver', artifacts: 'build/libs/*.jar,build/distributions/*.zip', fingerprint: true]) +} + +// vim: ft=groovy From 5918f139282fc43b5a639f4036d358642df6e7bc Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Wed, 3 Aug 2016 22:56:43 -0700 Subject: [PATCH 2/2] Execute our tests inside of a JDK8 container --- Jenkinsfile | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f7e1cf7..64a6fc7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,27 +1,20 @@ -node { - stage 'Clean workspace' - /* Running on a fresh Docker instance makes this redundant, but just in - * case the host isn't configured to give us a new Docker image for every - * build, make sure we clean things before we do anything - */ - deleteDir() +#!/usr/bin/env groovy +node('docker') { + stage 'Cleanup workspace' + deleteDir() stage 'Checkout source' checkout scm - stage 'Build and test' - /* if we can't install everything we need for Ruby in less than 15 minutes - * we might as well just give up - */ - timeout(30) { - sh './gradlew -iS' + docker.image('java:8-jdk').inside { + timeout(30) { + sh './gradlew -iS' + } } stage 'Capture test results and artifacts' - step([$class: 'JUnitResultArchiver', testResults: 'build/test-results/**/*.xml']) - step([$class: 'ArtifactArchiver', artifacts: 'build/libs/*.jar,build/distributions/*.zip', fingerprint: true]) + junit 'build/test-results/**/*.xml' + archiveArtifacts artifacts: 'build/libs/*.jar,build/distributions/*.zip', fingerprint: true } - -// vim: ft=groovy