From a3bd7a69e76c31b0d3e8457f79563d47d6dae50b Mon Sep 17 00:00:00 2001 From: Eric Haag Date: Tue, 17 Oct 2023 12:47:59 -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 #2158 --- .gitignore | 3 ++- .mvn/extensions.xml | 13 +++++++++++++ .mvn/gradle-enterprise.xml | 31 +++++++++++++++++++++++++++++++ Jenkinsfile | 24 +++++++++++++++++++++--- README.adoc | 2 +- 5 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/gradle-enterprise.xml diff --git a/.gitignore b/.gitignore index 2c4bd1cd3..51c071aa8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ target .project .classpath .idea -credentials.yml \ No newline at end of file +credentials.yml +.mvn/.gradle-enterprise diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 000000000..ebd761025 --- /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 000000000..c24406314 --- /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 168a59f38..1cbb520bf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,11 +25,17 @@ 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 { 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 clean dependency:list verify -Dsort -B' + 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 clean dependency:list verify -Dsort -B' } } } @@ -51,11 +57,17 @@ 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 { docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.basic']) { - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list verify -Dsort -B' + 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 clean dependency:list verify -Dsort -B' } } } @@ -71,12 +83,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 6a34cfc7e..8f145d6e0 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -= Spring Data Build Infrastructure image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-build%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-build/] += Spring Data Build Infrastructure image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-build%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-build/] 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 Build"] This repository contains common infrastructure to be used by Spring Data modules that build with Maven. It consists of a _resources_ project that bundles up resources that are needed during the build CSS for reference documentation generation and JavaDoc. The second project is _parent_ that can be used as parent project to pre-configure core dependencies, properties, reference documentation generation and most important of all the appropriate distribution assembly.