From 8404616bcc9474ca0ad4a97473db9bba7734d305 Mon Sep 17 00:00:00 2001 From: Eric Haag Date: Mon, 16 Oct 2023 15:50:45 -0500 Subject: [PATCH] Connect build 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 See #1853 --- .gitignore | 2 ++ .mvn/extensions.xml | 13 +++++++++++++ .mvn/gradle-enterprise.xml | 31 +++++++++++++++++++++++++++++++ Jenkinsfile | 12 +++++++++++- README.adoc | 2 +- ci/clean.sh | 8 +++++++- ci/test.sh | 8 +++++++- 7 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/gradle-enterprise.xml diff --git a/.gitignore b/.gitignore index 5006394a..1a16ace3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ node_modules node package.json package-lock.json + +.mvn/.gradle-enterprise diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 00000000..ebd76102 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,13 @@ + + + + com.gradle + gradle-enterprise-maven-extension + 1.19.2 + + + com.gradle + common-custom-user-data-maven-extension + 1.12.4 + + diff --git a/.mvn/gradle-enterprise.xml b/.mvn/gradle-enterprise.xml new file mode 100644 index 00000000..c2440631 --- /dev/null +++ b/.mvn/gradle-enterprise.xml @@ -0,0 +1,31 @@ + + + + https://ge.spring.io + + + false + true + true + + #{{'0.0.0.0'}} + + + + + true + + + + + ${env.DEVELOCITY_CACHE_USERNAME} + ${env.DEVELOCITY_CACHE_PASSWORD} + + + true + #{env['DEVELOCITY_CACHE_USERNAME'] != null and env['DEVELOCITY_CACHE_PASSWORD'] != null} + + + diff --git a/Jenkinsfile b/Jenkinsfile index f04b2676..f792b6cb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,6 +32,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES') } environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}") + DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}") } steps { script { @@ -59,6 +61,8 @@ pipeline { options { timeout(time: 30, unit: 'MINUTES') } environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}") + DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}") } steps { script { @@ -87,12 +91,18 @@ pipeline { environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") + DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}") + DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.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 -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase-non-root ' + + sh 'MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" '+ + 'DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} ' + + 'DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} ' + + 'GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} ' + + './mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase-non-root ' + '-Dartifactory.server=https://repo.spring.io ' + "-Dartifactory.username=${ARTIFACTORY_USR} " + "-Dartifactory.password=${ARTIFACTORY_PSW} " + diff --git a/README.adoc b/README.adoc index ede33955..90035344 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -= Spring Data Couchbase image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-couchbase%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-couchbase/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] += Spring Data Couchbase image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-couchbase%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-couchbase/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] image:https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Gradle Enterprise", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Couchbase"] The primary goal of the https://www.springsource.org/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce diff --git a/ci/clean.sh b/ci/clean.sh index 4986aaf4..9c5eddcb 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,5 +2,11 @@ set -euo pipefail -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ +export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} +export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} + +# The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY +export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} + +MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase diff --git a/ci/test.sh b/ci/test.sh index 5601c373..804e807a 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -5,6 +5,12 @@ set -euo pipefail mkdir -p /tmp/jenkins-home/.m2/spring-data-couchbase chown -R 1001:1001 . -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ +export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} +export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} + +# The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY +export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} + +MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml \ -P${PROFILE} clean dependency:list test -Dsort -Dbundlor.enabled=false -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase