From 979987ae9adfd152e5a1b0af14ce29f18ed50117 Mon Sep 17 00:00:00 2001 From: "Greg L. Turnquist" Date: Thu, 14 Sep 2023 10:08:19 -0500 Subject: [PATCH] Connect built 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 | 1 + .mvn/extensions.xml | 13 +++++++++++ .mvn/gradle-enterprise.xml | 31 +++++++++++++++++++++++++ Jenkinsfile | 29 +++++++++++++++++------ 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, 104 insertions(+), 14 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/gradle-enterprise.xml diff --git a/.gitignore b/.gitignore index 12e9892c9..96365583d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ _site credentials.yml .flattened-pom.xml +.mvn/.gradle-enterprise \ No newline at end of file diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 000000000..85a16c3aa --- /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 000000000..135c11834 --- /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 16b604cb9..ff73b1ff3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,6 +37,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 { @@ -50,7 +52,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 { @@ -59,6 +61,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 { @@ -74,6 +78,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 { @@ -89,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 { @@ -104,6 +112,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 { @@ -126,6 +136,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 { @@ -158,7 +170,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( @@ -186,22 +198,25 @@ pipeline { stage('Release documentation') { when { - anyOf { - branch 'main' - branch 'release' - } + beforeAgent(true) + branch(pattern: "main|release", 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 -Pjakarta-ee-10,distribute,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 80d113fd2..e3976a735 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 fc2046cf0..eaa141d61 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 ff3d66d35..ce32d353e 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -16,3 +16,5 @@ docker.java.inside.basic=-v $HOME:/tmp/jenkins-home # Credentials artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c dockerhub.credentials=hub.docker.com-springbuildmaster +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 2df068275..0958b2067 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 6e835bca2..1c51d9acc 100644 --- a/pom.xml +++ b/pom.xml @@ -291,6 +291,26 @@ + + + + + com.gradle + gradle-enterprise-maven-extension + + + + + + builddef.lst + + + + + + + + @@ -812,15 +832,14 @@ true + + false + spring-milestone https://repo.spring.io/milestone - - spring-release - https://repo.spring.io/release - @@ -830,6 +849,9 @@ true + + false + spring-milestone