From 4a1311b2141ce1f6cf7e9b1ab4235a0938509d18 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 08:49:29 +0000 Subject: [PATCH 1/7] Revert "version set to 0.6.0-SNAPSHOT" This reverts commit 463d633ed91e253b667ee5a5e48a98f942f3e766. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7febbd4..92dfb5e 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ mon - 0.6.0-SNAPSHOT + 0.5.1 1.8 From b2eda3252aab6b4231799633763ace5a428583c4 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 08:53:41 +0000 Subject: [PATCH 2/7] jenkins: fix syntax --- Jenkinsfile.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index d66f124..d272c7c 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -1,5 +1,6 @@ final String gitRepoUrl = 'git@github.com:kemitix/mon.git' final String mvn = "mvn --batch-mode --update-snapshots" +def pom = readMavenPom file: 'pom.xml' pipeline { agent any @@ -11,9 +12,8 @@ pipeline { } stage('no SNAPSHOT in master') { // checks that the pom version is not a snapshot when the current branch is master - when { expression (env.GIT_BRANCH == 'master') } + when { expression { (env.GIT_BRANCH == 'master') } } steps { - def pom = readMavenPom file: 'pom.xml' if ((pom.version).contains("SNAPSHOT")) { error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") } From c074b6e549f17537651b940a5ebc4f93f3e87684 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 09:03:35 +0000 Subject: [PATCH 3/7] jenkins: fix syntax #2 --- Jenkinsfile.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index d272c7c..8d193dd 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -12,11 +12,14 @@ pipeline { } stage('no SNAPSHOT in master') { // checks that the pom version is not a snapshot when the current branch is master - when { expression { (env.GIT_BRANCH == 'master') } } + // TODO: also check for SNAPSHOT when is a pull request with master as the target branch + when { + expression { + (env.GIT_BRANCH == 'master') && + (pom.version).contains("SNAPSHOT") } + } steps { - if ((pom.version).contains("SNAPSHOT")) { - error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") - } + error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") } } stage('Build') { From 5a73f5d7ae3dc8591e3fdde3197bff1476bf1ec2 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 09:22:28 +0000 Subject: [PATCH 4/7] jenkins: strong type read pom --- Jenkinsfile.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 8d193dd..45684a5 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -1,6 +1,6 @@ final String gitRepoUrl = 'git@github.com:kemitix/mon.git' final String mvn = "mvn --batch-mode --update-snapshots" -def pom = readMavenPom file: 'pom.xml' +final Model pom = readMavenPom file: 'pom.xml' pipeline { agent any From d6564cef08d333cafa1f3271cbcf62fa8ef2047e Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 09:26:36 +0000 Subject: [PATCH 5/7] jenkins: fix syntax #3 --- Jenkinsfile.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 45684a5..0ea3cfc 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -1,6 +1,5 @@ final String gitRepoUrl = 'git@github.com:kemitix/mon.git' final String mvn = "mvn --batch-mode --update-snapshots" -final Model pom = readMavenPom file: 'pom.xml' pipeline { agent any @@ -13,6 +12,7 @@ pipeline { stage('no SNAPSHOT in master') { // checks that the pom version is not a snapshot when the current branch is master // TODO: also check for SNAPSHOT when is a pull request with master as the target branch + final Model pom = readMavenPom file: 'pom.xml' when { expression { (env.GIT_BRANCH == 'master') && From 08e051799d02604578c30e00f39b83d05622ba39 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 11:55:44 +0000 Subject: [PATCH 6/7] jenkins: fix syntax #4 --- Jenkinsfile.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 0ea3cfc..b62191b 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -12,13 +12,13 @@ pipeline { stage('no SNAPSHOT in master') { // checks that the pom version is not a snapshot when the current branch is master // TODO: also check for SNAPSHOT when is a pull request with master as the target branch - final Model pom = readMavenPom file: 'pom.xml' when { expression { (env.GIT_BRANCH == 'master') && - (pom.version).contains("SNAPSHOT") } + (readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") } } steps { + def pom = readMavenPom(file: 'pom.xml') error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") } } From 88cdd087f125c6be4c700c18c2b672bc7fabc9e7 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 11:59:10 +0000 Subject: [PATCH 7/7] jenkins: fix syntax #5 --- Jenkinsfile.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index b62191b..b9d862b 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -18,8 +18,7 @@ pipeline { (readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") } } steps { - def pom = readMavenPom(file: 'pom.xml') - error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") + error("Build failed because SNAPSHOT version") } } stage('Build') {