From 97e41dd15399a733f1b265c0c75fc50f5b0eeecd Mon Sep 17 00:00:00 2001 From: Greg Turnquist Date: Mon, 13 May 2019 13:40:57 -0500 Subject: [PATCH] DATACMNS-1536 - Introduce Jenkins. --- Jenkinsfile | 82 +++++++++++++++++++++++++++++++++++++++++++----- ci/build.sh | 11 +------ ci/build.yml | 20 ------------ ci/test.sh | 8 +---- ci/test.yml | 17 ---------- doc-settings.xml | 14 +++++++++ pom.xml | 41 ++++++++++++++++++++++++ 7 files changed, 131 insertions(+), 62 deletions(-) delete mode 100644 ci/build.yml delete mode 100644 ci/test.yml create mode 100644 doc-settings.xml diff --git a/Jenkinsfile b/Jenkinsfile index 5f643d38f..faa581b55 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,80 @@ pipeline { - agent { - docker { - image 'maven:3.3.3' - } - } + agent none + + triggers { + pollSCM 'H/10 * * * *' + } + stages { - stage('build') { + stage("Test") { + parallel { + stage("test: baseline") { + agent { + docker { + image 'adoptopenjdk/openjdk8:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=none ci/test.sh" + } + } + } + } + stage('Release to artifactory') { + when { + branch 'issue/*' + } + agent { + docker { + image 'adoptopenjdk/openjdk8:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + + environment { + ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + } + steps { - sh 'mvn clean dependency:list test -Dsort -U' + sh "USERNAME=${ARTIFACTORY_USR} PASSWORD=${ARTIFACTORY_PSW} DOC_USERNAME=${DOC_USR} DOC_PASSWORD=${DOC_PSW} PROFILE=ci,snapshot ci/build.sh" + } + } + stage('Release to artifactory with docs') { + when { + branch 'test' + } + agent { + docker { + image 'adoptopenjdk/openjdk8:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + + environment { + ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + DOC = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + } + + steps { + sh "USERNAME=${ARTIFACTORY_USR} PASSWORD=${ARTIFACTORY_PSW} DOC_USERNAME=${DOC_USR} DOC_PASSWORD=${DOC_PSW} PROFILE=ci,snapshot ci/build.sh" } } } -} \ No newline at end of file + + post { + changed { + script { + slackSend( + color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger', + channel: '#spring-data-dev', + message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}") + emailext( + subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}", + mimeType: 'text/html', + recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']], + body: "${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}") + } + } + } +} diff --git a/ci/build.sh b/ci/build.sh index 0edb66795..6a202bbe9 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,13 +2,4 @@ set -euo pipefail -[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 - -spring_data_commons_artifactory=$(pwd)/spring-data-commons-artifactory - -rm -rf $HOME/.m2/repository/org/springframework/data/commons 2> /dev/null || : - -cd spring-data-commons-github - -./mvnw -Dmaven.test.skip=true clean deploy \ - -DaltDeploymentRepository=distribution::default::file://${spring_data_commons_artifactory} +./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B diff --git a/ci/build.yml b/ci/build.yml deleted file mode 100644 index 6960465e6..000000000 --- a/ci/build.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -platform: linux - -image_resource: - type: docker-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: spring-data-commons-github - -outputs: -- name: spring-data-commons-artifactory - -caches: -- path: maven - -run: - path: spring-data-commons-github/ci/build.sh diff --git a/ci/test.sh b/ci/test.sh index 34174bd6e..f6bb0bf13 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -2,10 +2,4 @@ set -euo pipefail -[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 - -rm -rf $HOME/.m2/repository/org/springframework/data/commons 2> /dev/null || : - -cd spring-data-commons-github - -./mvnw clean dependency:list test -P${PROFILE} -Dsort +./mvnw -P${PROFILE} clean dependency:list test -Dsort -B diff --git a/ci/test.yml b/ci/test.yml deleted file mode 100644 index b8f105a33..000000000 --- a/ci/test.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -platform: linux - -image_resource: - type: docker-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: spring-data-commons-github - -caches: -- path: maven - -run: - path: spring-data-commons-github/ci/test.sh diff --git a/doc-settings.xml b/doc-settings.xml new file mode 100644 index 000000000..6c661591f --- /dev/null +++ b/doc-settings.xml @@ -0,0 +1,14 @@ + + + + + static-dot-s2 + ${env.DOC_USERNAME} + ${env.DOC_PASSWORD} + + + + diff --git a/pom.xml b/pom.xml index 1fbd1ab7b..468ecd88e 100644 --- a/pom.xml +++ b/pom.xml @@ -363,6 +363,47 @@ + + snapshot + + + + + org.jfrog.buildinfo + artifactory-maven-plugin + 2.6.1 + false + + + build-info + + publish + + + + {{BUILD_URL}} + + + spring-data-commons + spring-data-commons + false + *:*:*:*@zip + + + https://repo.spring.io + {{USERNAME}} + {{PASSWORD}} + libs-snapshot-local + libs-snapshot-local + + + + + + + + + release