Backport releasing to sonatype.

Migrate all the various tweaks made to work with Sonatype.
This commit is contained in:
Greg L. Turnquist
2021-01-05 13:54:29 -06:00
parent dacd3131c6
commit c946d7febb
12 changed files with 386 additions and 408 deletions

122
Jenkinsfile vendored
View File

@@ -10,26 +10,11 @@ pipeline {
}
stages {
stage('Publish OpenJDK 8 + jq docker image') {
when {
changeset "ci/Dockerfile"
}
agent any
steps {
script {
def image = docker.build("springci/spring-session-data-mongodb-openjdk8-with-jq", "ci/")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
image.push()
}
}
}
}
stage("Test: baseline (jdk8)") {
agent {
docker {
image 'adoptopenjdk/openjdk8:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
steps {
@@ -42,7 +27,7 @@ pipeline {
agent {
docker {
image 'adoptopenjdk/openjdk8:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
steps {
@@ -53,7 +38,7 @@ pipeline {
agent {
docker {
image 'adoptopenjdk/openjdk11:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
steps {
@@ -64,7 +49,7 @@ pipeline {
agent {
docker {
image 'adoptopenjdk/openjdk11:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
steps {
@@ -75,7 +60,7 @@ pipeline {
agent {
docker {
image 'adoptopenjdk/openjdk13:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
steps {
@@ -86,7 +71,7 @@ pipeline {
agent {
docker {
image 'adoptopenjdk/openjdk13:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
steps {
@@ -95,25 +80,26 @@ pipeline {
}
}
}
stage('Deploy to Artifactory') {
stage('Deploy') {
agent {
docker {
image 'adoptopenjdk/openjdk8:latest'
args '-v $HOME/.m2:/root/.m2'
image 'springci/spring-session-data-mongodb-openjdk8-with-jq:latest'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 20, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
SONATYPE = credentials('oss-login')
KEYRING = credentials('spring-signing-secring.gpg')
PASSPHRASE = credentials('spring-gpg-passphrase')
}
steps {
script {
// Warm up this plugin quietly before using it.
sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version"
PROJECT_VERSION = sh(
script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO",
script: "ci/version.sh",
returnStdout: true
).trim()
@@ -125,34 +111,31 @@ pipeline {
RELEASE_TYPE = 'release'
}
OUTPUT = sh(
script: "PROFILE=distribute,docs,${RELEASE_TYPE} ci/build.sh",
returnStdout: true
).trim()
if (RELEASE_TYPE == 'release') {
sh "PROFILE=central USERNAME=${SONATYPE_USR} PASSWORD=${SONATYPE_PSW} ci/build-and-deploy-to-maven-central.sh ${PROJECT_VERSION}"
echo "$OUTPUT"
slackSend(
color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
channel: '#spring-session-bot',
message: "@here Spring Session for MongoDB ${PROJECT_VERSION} is staged on Sonatype awaiting closure and release.")
build_info_path = OUTPUT.split('\n')
.find { it.contains('Artifactory Build Info Recorder') }
.split('Saving Build Info to ')[1]
.trim()[1..-2]
dir(build_info_path + '/..') {
stash name: 'build_info', includes: "*.json"
} else {
sh "PROFILE=${RELEASE_TYPE} ci/build-and-deploy-to-artifactory.sh"
}
}
}
}
stage('Promote to Bintray') {
stage('Release documentation') {
when {
branch 'release-2.3'
}
agent {
docker {
image 'springci/spring-session-data-mongodb-openjdk8-with-jq:latest'
args '-v $HOME/.m2:/root/.m2'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 20, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
@@ -160,55 +143,12 @@ pipeline {
steps {
script {
// Warm up this plugin quietly before using it.
sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version"
PROJECT_VERSION = sh(
script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO",
returnStdout: true
).trim()
if (PROJECT_VERSION.endsWith('RELEASE')) {
unstash name: 'build_info'
sh "ci/promote-to-bintray.sh"
} else {
echo "${PROJECT_VERSION} is not a candidate for promotion to Bintray."
}
}
}
}
stage('Sync to Maven Central') {
when {
branch 'release-2.3'
}
agent {
docker {
image 'springci/spring-session-data-mongodb-openjdk8-with-jq:latest'
args '-v $HOME/.m2:/root/.m2'
}
}
environment {
BINTRAY = credentials('Bintray-spring-operator')
SONATYPE = credentials('oss-token')
}
steps {
script {
// Warm up this plugin quietly before using it.
sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version"
PROJECT_VERSION = sh(
script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO",
returnStdout: true
).trim()
if (PROJECT_VERSION.endsWith('RELEASE')) {
unstash name: 'build_info'
sh "ci/sync-to-maven-central.sh"
} else {
echo "${PROJECT_VERSION} is not a candidate for syncing to Maven Central."
}
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pdocs ' +
'-Dartifactory.server=https://repo.spring.io ' +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
"-Dartifactory.distribution-repository=temp-private-local " +
'deploy -B'
}
}
}