From fc9f9d8e5cda0595349255c9e9a1332a52001c27 Mon Sep 17 00:00:00 2001 From: Eric Haag Date: Fri, 15 Sep 2023 14:45:06 -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 #2732 --- .gitignore | 1 + .mvn/extensions.xml | 13 +++++++++++++ .mvn/gradle-enterprise.xml | 31 +++++++++++++++++++++++++++++++ Jenkinsfile | 34 +++++++++++++++++++++++----------- README.adoc | 2 +- ci/test.sh | 8 +++++++- 6 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/gradle-enterprise.xml diff --git a/.gitignore b/.gitignore index 67b98e6f5d..419a1317bd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ 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 0000000000..ebd7610255 --- /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 0000000000..c244063147 --- /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 5f60ef67a5..50c3b81adb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,6 +77,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 { @@ -88,14 +90,14 @@ pipeline { } stage("Test other configurations") { - when { - beforeAgent(true) - anyOf { - branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") - not { triggeredBy 'UpstreamCause' } - } - } - parallel { + when { + beforeAgent(true) + anyOf { + branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") + not { triggeredBy 'UpstreamCause' } + } + } + parallel { stage("test: native-hints") { agent { label 'data' @@ -103,6 +105,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 { @@ -119,6 +123,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 { @@ -128,8 +134,8 @@ pipeline { } } } - } - } + } + } stage('Release to artifactory') { when { @@ -146,12 +152,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 ' + + 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 ' + '-Dartifactory.server=https://repo.spring.io ' + "-Dartifactory.username=${ARTIFACTORY_USR} " + "-Dartifactory.password=${ARTIFACTORY_PSW} " + diff --git a/README.adoc b/README.adoc index f48b058f05..3408547189 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,7 @@ image:https://spring.io/badges/spring-data-redis/ga.svg[Spring Data Redis,link=https://spring.io/projects/spring-data-redis/#quick-start] image:https://spring.io/badges/spring-data-redis/snapshot.svg[Spring Data Redis,link=https://spring.io/projects/spring-data-redis/#quick-start] -= Spring Data Redis image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-redis%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-redis/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] += Spring Data Redis image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-redis%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-redis/] 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 Redis"] The primary goal of the https://spring.io/projects/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 frameworks, and cloud based data services. diff --git a/ci/test.sh b/ci/test.sh index 373156e031..445a65fa5f 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -10,8 +10,14 @@ cwd=$(pwd) # Launch Redis in proper configuration pushd /tmp && ln -s /work && make -f $cwd/Makefile start && popd +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} + # Execute maven test -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B +MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B # Capture resulting exit code from maven (pass/fail) RESULT=$?