From 0277f079d2be9463ba9df2ca663dca80ad164377 Mon Sep 17 00:00:00 2001 From: Eric Haag Date: Wed, 30 Aug 2023 10:27:51 -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 #3142 --- .gitignore | 1 + .mvn/extensions.xml | 13 +++++++++++++ .mvn/gradle-enterprise.xml | 31 +++++++++++++++++++++++++++++++ Jenkinsfile | 24 ++++++++++++++++++------ README.adoc | 5 ++++- ci/clean.sh | 6 ------ ci/pipeline.properties | 2 ++ ci/test.sh | 12 +++++++++++- pom.xml | 20 ++++++++++++++++++++ 9 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/gradle-enterprise.xml delete mode 100755 ci/clean.sh diff --git a/.gitignore b/.gitignore index e01b6ea60..6b743d765 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ package-lock.json package.json node build/ +.mvn/.gradle-enterprise 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 7b7d4d340..52f4f2cf2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,13 +32,14 @@ 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']}") TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor' } steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) { sh 'PROFILE=all-dbs ci/test.sh' - sh "ci/clean.sh" } } } @@ -61,13 +62,14 @@ 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']}") TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor' } steps { script { docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) { sh 'PROFILE=all-dbs,hibernate-63-next ci/test.sh' - sh "ci/clean.sh" } } } @@ -79,13 +81,14 @@ 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']}") TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor' } steps { script { docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) { sh 'PROFILE=all-dbs ci/test.sh' - sh "ci/clean.sh" } } } @@ -97,13 +100,14 @@ 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']}") TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor' } steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) { sh 'PROFILE=all-dbs,eclipselink-next ci/test.sh' - sh "ci/clean.sh" } } } @@ -126,19 +130,27 @@ pipeline { 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 -Pci,artifactory ' + + 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} ' + + 'GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY} ' + + './mvnw -s settings.xml -Pci,artifactory ' + '-Dartifactory.server=https://repo.spring.io ' + "-Dartifactory.username=${ARTIFACTORY_USR} " + "-Dartifactory.password=${ARTIFACTORY_PSW} " + "-Dartifactory.staging-repository=libs-snapshot-local " + "-Dartifactory.build-name=spring-data-jpa " + "-Dartifactory.build-number=${BUILD_NUMBER} " + - '-Dmaven.test.skip=true clean deploy -U -B' + '-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa-enterprise ' + + '-Dmaven.test.skip=true clean deploy -U -B ' + } } } diff --git a/README.adoc b/README.adoc index 276da0427..15ecfb1e9 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,7 @@ -= Spring Data JPA image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jpa%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-jpa/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] +image:https://spring.io/badges/spring-data-jpa/ga.svg[Spring Data JPA,link=https://projects.spring.io/spring-data-jpa/#quick-start] +image:https://spring.io/badges/spring-data-jpa/snapshot.svg[Spring Data JPA,link=https://projects.spring.io/spring-data-jpa/#quick-start] + += Spring Data JPA image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jpa%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-jpa/] 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 JPA Parent"] Spring Data JPA, part of the larger https://projects.spring.io/spring-data[Spring Data] family, makes it easy to implement JPA-based repositories. This module deals with enhanced support for JPA-based data access layers. diff --git a/ci/clean.sh b/ci/clean.sh deleted file mode 100755 index 7b38a05c9..000000000 --- a/ci/clean.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -x - -set -euo pipefail - -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ - ./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa diff --git a/ci/pipeline.properties b/ci/pipeline.properties index 0359247e8..c02f2a123 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -25,3 +25,5 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock - docker.registry= docker.credentials=hub.docker.com-springbuildmaster 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 ffb33bccf..dfb14eff3 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -3,8 +3,18 @@ set -euo pipefail mkdir -p /tmp/jenkins-home/.m2/spring-data-jpa +mkdir -p /tmp/jenkins-home/.m2/.gradle-enterprise chown -R 1001:1001 . +export GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR} +export GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW} +export GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY} + MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml \ - -P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa \ No newline at end of file + -P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa + +MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ + ./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa + +chown -R 1001:1001 /tmp/jenkins-home/.m2/.gradle-enterprise diff --git a/pom.xml b/pom.xml index dd2134e5d..1169772ef 100644 --- a/pom.xml +++ b/pom.xml @@ -221,6 +221,26 @@ + + + + + com.gradle + gradle-enterprise-maven-extension + + + + + + builddef.lst + + + + + + + +