From bc82b0f7076c373aa13f38dca86f9d7a9599a5c0 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 | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ ci/build.sh | 5 +++ ci/test.sh | 5 +++ doc-settings.xml | 14 +++++++++ pom.xml | 41 +++++++++++++++++++++++++ 5 files changed, 145 insertions(+) create mode 100644 Jenkinsfile create mode 100755 ci/build.sh create mode 100755 ci/test.sh create mode 100644 doc-settings.xml diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..faa581b55 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,80 @@ +pipeline { + agent none + + triggers { + pollSCM 'H/10 * * * *' + } + + stages { + 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 "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" + } + } + } + + 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 new file mode 100755 index 000000000..6a202bbe9 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -euo pipefail + +./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B diff --git a/ci/test.sh b/ci/test.sh new file mode 100755 index 000000000..f6bb0bf13 --- /dev/null +++ b/ci/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -euo pipefail + +./mvnw -P${PROFILE} clean dependency:list test -Dsort -B 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 99fbd00b6..58e3ed645 100644 --- a/pom.xml +++ b/pom.xml @@ -372,6 +372,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