From 97f6a7c6eb93e9573e54fc52068df33a99d7ac3f Mon Sep 17 00:00:00 2001 From: "Greg L. Turnquist" Date: Thu, 14 Sep 2023 10:08:19 -0500 Subject: [PATCH] Connect builds to ge.spring.io. This change publishes a build scan to ge.spring.io for every local build from an authenticated Spring committer and for CI where appropriate access tokens are available. The build will not fail if publishing fails. This change also allows the build to benefit from local and remote build caching, providing faster builds for all contributors. Additionally, the project will have access to all features of Gradle Enterprise such as: - Dashboards to view all historical build scans, along with performance trends over time - Build failure analytics for enhanced investigation and diagnosis of build failures - Test failure analytics to better understand trends and causes around slow, failing, and flaky tests Resolves #1376. --- .gitignore | 4 ++- .mvn/extensions.xml | 13 +++++++++ .mvn/gradle-enterprise.xml | 31 ++++++++++++++++++++++ Jenkinsfile | 35 ++++++++++++++++++++----- ci/build-and-deploy-to-artifactory.sh | 3 +++ ci/build-and-deploy-to-maven-central.sh | 3 +++ ci/pipeline.properties | 2 ++ ci/test.sh | 6 ++--- pom.xml | 30 ++++++++++++++++++--- 9 files changed, 112 insertions(+), 15 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/gradle-enterprise.xml diff --git a/.gitignore b/.gitignore index 235706c9..65d226e3 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,6 @@ _site credentials.yml # Things to ignore that facilitate backports. -spring-ws-bom \ No newline at end of file +spring-ws-bom +.flattened-pom.xml +.mvn/.gradle-enterprise diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 00000000..85a16c3a --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,13 @@ + + + + com.gradle + gradle-enterprise-maven-extension + 1.18.1 + + + com.gradle + common-custom-user-data-maven-extension + 1.12.2 + + \ No newline at end of file diff --git a/.mvn/gradle-enterprise.xml b/.mvn/gradle-enterprise.xml new file mode 100644 index 00000000..135c1183 --- /dev/null +++ b/.mvn/gradle-enterprise.xml @@ -0,0 +1,31 @@ + + + + https://ge.spring.io + + + false + true + true + + #{{'0.0.0.0'}} + + + + + true + + + + + spring-builds+jenkins + ${env.GRADLE_ENTERPRISE_CACHE_PASSWORD} + + + true + #{env['GRADLE_ENTERPRISE_CACHE_USERNAME'] != null and env['GRADLE_ENTERPRISE_CACHE_PASSWORD'] != null} + + + \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 08818eaa..51acb0d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -35,7 +37,7 @@ pipeline { stage("Test other configurations") { when { beforeAgent(true) - branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") + branch(pattern: "main|(\\d\\.\\d\\.x)|issue/.+", comparator: "REGEXP") } parallel { @@ -44,6 +46,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -59,6 +63,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -73,6 +79,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -87,6 +95,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -101,6 +111,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -115,6 +127,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -129,6 +143,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES')} environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { @@ -150,6 +166,8 @@ pipeline { KEYRING = credentials('spring-signing-secring.gpg') PASSPHRASE = credentials('spring-gpg-passphrase') STAGING_PROFILE_ID = credentials('spring-data-release-deployment-maven-central-staging-profile-id') + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { @@ -182,7 +200,7 @@ pipeline { sh "ci/build-and-deploy-to-maven-central.sh ${PROJECT_VERSION} ${STAGING_REPOSITORY_ID}" sh "ci/rc-close.sh ${STAGING_REPOSITORY_ID}" - sh "ci/smoke-test-against-maven-central.sh ${PROJECT_VERSION} ${STAGING_REPOSITORY_ID}" +// sh "ci/smoke-test-against-maven-central.sh ${PROJECT_VERSION} ${STAGING_REPOSITORY_ID}" sh "ci/rc-release.sh ${STAGING_REPOSITORY_ID}" slackSend( @@ -210,22 +228,25 @@ pipeline { stage('Release documentation') { when { - anyOf { - branch '3.1.x' - branch 'release-3.1.x' - } + beforeAgent(true) + branch(pattern: "(release-)?(\\d\\.\\d\\.x)", comparator: "REGEXP") } agent any options { timeout(time: 20, unit: 'MINUTES') } environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}") + GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}") } steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) { - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pjakarta-ee-10,distribute,docs ' + + sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ' + + 'GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR} ' + + 'GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW} ' + + './mvnw -s settings.xml -Pdistribute,docs ' + '-Dartifactory.server=https://repo.spring.io ' + "-Dartifactory.username=${ARTIFACTORY_USR} " + "-Dartifactory.password=${ARTIFACTORY_PSW} " + diff --git a/ci/build-and-deploy-to-artifactory.sh b/ci/build-and-deploy-to-artifactory.sh index ae919d17..ac132cd3 100755 --- a/ci/build-and-deploy-to-artifactory.sh +++ b/ci/build-and-deploy-to-artifactory.sh @@ -4,6 +4,9 @@ set -euo pipefail RELEASE_TYPE=$1 +export GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR} +export GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW} + echo 'Deploying to Artifactory...' MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \ diff --git a/ci/build-and-deploy-to-maven-central.sh b/ci/build-and-deploy-to-maven-central.sh index 87793df8..2826f84c 100755 --- a/ci/build-and-deploy-to-maven-central.sh +++ b/ci/build-and-deploy-to-maven-central.sh @@ -5,6 +5,9 @@ set -euo pipefail PROJECT_VERSION=$1 STAGING_REPOSITORY_ID=$2 +export GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR} +export GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW} + echo 'Staging on Maven Central...' GNUPGHOME=/tmp/gpghome diff --git a/ci/pipeline.properties b/ci/pipeline.properties index 8063fe97..98a79390 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -13,3 +13,5 @@ docker.java.inside.basic=-v $HOME:/tmp/jenkins-home # Credentials artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c +gradle-enterprise-cache.credentials=gradle_enterprise_cache_user +gradle-enterprise.access-key=gradle_enterprise_secret_access_key diff --git a/ci/test.sh b/ci/test.sh index 2df06827..0958b206 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -2,9 +2,9 @@ set -euo pipefail -mkdir -p /tmp/jenkins-home/.m2/spring-ws -chown -R 1001:1001 . +export GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR} +export GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW} MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml \ - -P${PROFILE} clean dependency:list test -Dsort -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-ws + -P${PROFILE} clean dependency:list test -Dsort -B diff --git a/pom.xml b/pom.xml index e2139360..1805480e 100644 --- a/pom.xml +++ b/pom.xml @@ -231,6 +231,26 @@ + + + + + com.gradle + gradle-enterprise-maven-extension + + + + + + builddef.lst + + + + + + + + @@ -848,15 +868,14 @@ true + + false + spring-milestone https://repo.spring.io/milestone - - spring-release - https://repo.spring.io/release - @@ -866,6 +885,9 @@ true + + false + spring-milestone