From 211297df9f68e89f48b15c12df37d1f969c4c441 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Mar 2018 17:37:23 +0000 Subject: [PATCH 1/3] jenkins: update to latest template --- Jenkinsfile | 28 ----------------------- Jenkinsfile.groovy | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 28 deletions(-) delete mode 100644 Jenkinsfile create mode 100644 Jenkinsfile.groovy diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 4e84469..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,28 +0,0 @@ -final String gitRepoUrl = 'git@github.com:kemitix/kemitix-parent.git' -final String mvn = "mvn --batch-mode --update-snapshots" - -pipeline { - agent any - stages { - stage('Prepare') { - steps { - git url: gitRepoUrl, branch: '**', credentialsId: 'github-kemitix' - } - } - stage('Build') { - steps { - withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { - sh "${mvn} clean install" - } - } - } - stage('Deploy') { - when { expression { (env.GIT_BRANCH == 'master') } } - steps { - withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { - sh "${mvn} deploy --activate-profiles release" - } - } - } - } -} diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy new file mode 100644 index 0000000..0e18978 --- /dev/null +++ b/Jenkinsfile.groovy @@ -0,0 +1,57 @@ +final String repoName = "kemitix-parent" +final String repoUrl = "git@github.com:kemitix/${repoName}.git" +final String mvn = "mvn --batch-mode --update-snapshots" + +pipeline { + agent any + stages { + stage('Prepare') { + steps { + git url: repoUrl, branch: '**', credentialsId: 'github-kemitix' + } + } + 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 + when { + expression { + (env.GIT_BRANCH == 'master') && + (readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") } + } + steps { + error("Build failed because SNAPSHOT version") + } + } + stage('Build') { + parallel { + stage('Java 8') { + steps { + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { + sh "${mvn} clean install" + } + } + } + stage('Java 9') { + steps { + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { + sh 'mvn clean install' + } + } + } + } + } + stage('Archiving') { + steps { + archiveArtifacts 'pom.xml' + } + } + stage('Deploy') { + when { expression { (env.GIT_BRANCH == 'master') } } + steps { + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { + sh "${mvn} deploy --activate-profiles release -DskipTests=true" + } + } + } + } +} From 5e28fbb65dfc2564ebeb8c5c5e3ca03af61e9a42 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Mar 2018 17:50:56 +0000 Subject: [PATCH 2/3] jenkins: build and deploy using Java 9 --- Jenkinsfile.groovy | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 0e18978..68be5c8 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -23,20 +23,9 @@ pipeline { } } stage('Build') { - parallel { - stage('Java 8') { - steps { - withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { - sh "${mvn} clean install" - } - } - } - stage('Java 9') { - steps { - withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { - sh 'mvn clean install' - } - } + steps { + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { + sh 'mvn clean install' } } } @@ -48,7 +37,7 @@ pipeline { stage('Deploy') { when { expression { (env.GIT_BRANCH == 'master') } } steps { - withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') { + withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { sh "${mvn} deploy --activate-profiles release -DskipTests=true" } } From af91570c01096cd7b709291e447ad7a9259fe7a9 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Mar 2018 18:06:12 +0000 Subject: [PATCH 3/3] lombok.config: added to prevent generated annotation --- lombok.config | 1 + 1 file changed, 1 insertion(+) create mode 100644 lombok.config diff --git a/lombok.config b/lombok.config new file mode 100644 index 0000000..00ebb3e --- /dev/null +++ b/lombok.config @@ -0,0 +1 @@ +lombok.addGeneratedAnnotation=false