From b02e9ec9ddfedfa9255a0840ce8cee146d6fc2fa Mon Sep 17 00:00:00 2001 From: "Greg L. Turnquist" Date: Tue, 2 Mar 2021 13:54:58 -0600 Subject: [PATCH] Migrate to new sonatype infrastructure. --- Jenkinsfile | 14 ++++++++------ ci/build-and-deploy-to-maven-central.sh | 2 +- ci/version.sh | 14 ++++++++++++++ pom.xml | 8 ++++---- 4 files changed, 27 insertions(+), 11 deletions(-) create mode 100755 ci/version.sh diff --git a/Jenkinsfile b/Jenkinsfile index bb9b9e0..4fdfde8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -106,19 +106,15 @@ pipeline { environment { ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') - SONATYPE = credentials('oss-token') + 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 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version' - - // Extract project's version number PROJECT_VERSION = sh( - script: 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./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() @@ -134,6 +130,12 @@ pipeline { if (RELEASE_TYPE == 'release') { sh "PROFILE=central USERNAME=${SONATYPE_USR} PASSWORD=${SONATYPE_PSW} ci/build-and-deploy-to-maven-central.sh ${PROJECT_VERSION}" + + 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.") + } else { sh "PROFILE=${RELEASE_TYPE} ci/build-and-deploy-to-artifactory.sh" } diff --git a/ci/build-and-deploy-to-maven-central.sh b/ci/build-and-deploy-to-maven-central.sh index d4f8b48..653901a 100755 --- a/ci/build-and-deploy-to-maven-central.sh +++ b/ci/build-and-deploy-to-maven-central.sh @@ -21,5 +21,5 @@ MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \ -Dmaven.test.skip=true \ -Dgpg.passphrase=${PASSPHRASE} \ -Dgpg.secretKeyring=${GNUPGHOME}/secring.gpg \ - -DstagingDescription="Releasing ${PROJECT_VERSION}" \ + -DstagingDescription="Releasing Spring Session for MongoDB ${PROJECT_VERSION}" \ clean deploy -B \ No newline at end of file diff --git a/ci/version.sh b/ci/version.sh new file mode 100755 index 0000000..3e9fb1b --- /dev/null +++ b/ci/version.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -euo pipefail + +RAW_VERSION=`MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \ + org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \ + -Dexpression=project.version -q -DforceStdout` + +# Split things up +VERSION_PARTS=($RAW_VERSION) + +# Grab the last part, which is the actual version number. +echo ${VERSION_PARTS[${#VERSION_PARTS[@]}-1]} + diff --git a/pom.xml b/pom.xml index 5d11dcf..788a357 100644 --- a/pom.xml +++ b/pom.xml @@ -582,10 +582,10 @@ true sonatype - https://oss.sonatype.org/ - true + https://s01.oss.sonatype.org/ + false true - false + true @@ -626,7 +626,7 @@ sonatype - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://s01.oss.sonatype.org//service/local/staging/deploy/maven2/