From ecfc3d94cf2e288f0d8995c82df9344bc2b9a24f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 26 Feb 2018 21:06:12 +0000 Subject: [PATCH 1/4] Rewrite Jenkinsfile --- Jenkinsfile | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 880b2ed..d43fdd7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,35 +1,32 @@ +def maven(goals, modules, profiles) { + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { + sh "mvn -U $profiles $modules $goals" + } +} + +def isBranch(branch) { + return env.GIT_BRANCH == branch +} + pipeline { agent any stages { stage('Prepare') { steps { - checkout([ - $class: 'GitSCM', - branches: [[name: '**']], - extensions: [[$class: 'CleanBeforeCheckout']], - userRemoteConfigs: [[credentialsId: 'github-kemitix', url: 'git@github.com:kemitix/conditional.git']] - ]) + git url: 'git@github.com:kemitix/condition.git', + branch: '**', + credentialsId: 'github-kemitix' } } stage('Build') { steps { - sh './mvnw -B -U clean install' - } - } - stage('Reporting') { - steps { - junit '**/target/surefire-reports/*.xml' - archiveArtifacts '**/target/*.jar' + maven("clean install", ".", "") } } stage('Deploy') { - when { - expression { - env.GIT_BRANCH == 'master' - } - } + when { expression { isBranch 'master' } } steps { - sh './mvnw -B -Dskip-Tests=true -P release deploy' + maven("deploy", allModules, "-P release") } } } From 288fbf02f459a47467cf24d29646e3b6ec94cfa6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 26 Feb 2018 21:07:02 +0000 Subject: [PATCH 2/4] pom: upgrade kemitix-maven-tiles to 0.5.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 00dd62e..6040f8c 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ 3.8.0 4.3.0 2.10 - 0.5.1 + 0.5.2 1.16.20 From 4f633f7e72038fe33e09ecd999114742d056b5e0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 27 Feb 2018 06:55:23 +0000 Subject: [PATCH 3/4] jenkins: inline methods --- Jenkinsfile | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d43fdd7..65449e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,13 +1,3 @@ -def maven(goals, modules, profiles) { - withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { - sh "mvn -U $profiles $modules $goals" - } -} - -def isBranch(branch) { - return env.GIT_BRANCH == branch -} - pipeline { agent any stages { @@ -20,13 +10,17 @@ pipeline { } stage('Build') { steps { - maven("clean install", ".", "") + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { + sh "mvn -B -U clean install" + } } } stage('Deploy') { - when { expression { isBranch 'master' } } + when { expression { (env.GIT_BRANCH == 'master') } } steps { - maven("deploy", allModules, "-P release") + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { + sh "mvn -B -U -P release deploy" + } } } } From 463c9586028bfed71d7673aaa66d25f91d569fe7 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 27 Feb 2018 06:56:22 +0000 Subject: [PATCH 4/4] jenkins: fix typo --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 65449e8..3efa81b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { stages { stage('Prepare') { steps { - git url: 'git@github.com:kemitix/condition.git', + git url: 'git@github.com:kemitix/conditional.git', branch: '**', credentialsId: 'github-kemitix' }