Skip to content

Commit 0f6e217

Browse files
erichaagdevgregturn
authored andcommitted
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
1 parent c6f9186 commit 0f6e217

9 files changed

+100
-14
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ package-lock.json
1313
package.json
1414
node
1515
build/
16+
.mvn/.gradle-enterprise

.mvn/extensions.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<extensions>
3+
<extension>
4+
<groupId>com.gradle</groupId>
5+
<artifactId>gradle-enterprise-maven-extension</artifactId>
6+
<version>1.18.1</version>
7+
</extension>
8+
<extension>
9+
<groupId>com.gradle</groupId>
10+
<artifactId>common-custom-user-data-maven-extension</artifactId>
11+
<version>1.12.2</version>
12+
</extension>
13+
</extensions>

.mvn/gradle-enterprise.xml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<gradleEnterprise
3+
xmlns="https://www.gradle.com/gradle-enterprise-maven" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://www.gradle.com/gradle-enterprise-maven https://www.gradle.com/schema/gradle-enterprise-maven.xsd">
5+
<server>
6+
<url>https://ge.spring.io</url>
7+
</server>
8+
<buildScan>
9+
<backgroundBuildScanUpload>false</backgroundBuildScanUpload>
10+
<captureGoalInputFiles>true</captureGoalInputFiles>
11+
<publishIfAuthenticated>true</publishIfAuthenticated>
12+
<obfuscation>
13+
<ipAddresses>#{{'0.0.0.0'}}</ipAddresses>
14+
</obfuscation>
15+
</buildScan>
16+
<buildCache>
17+
<local>
18+
<enabled>true</enabled>
19+
</local>
20+
<remote>
21+
<server>
22+
<credentials>
23+
<username>spring-builds+jenkins</username>
24+
<password>${env.GRADLE_ENTERPRISE_CACHE_PASSWORD}</password>
25+
</credentials>
26+
</server>
27+
<enabled>true</enabled>
28+
<storeEnabled>#{env['GRADLE_ENTERPRISE_CACHE_USERNAME'] != null and env['GRADLE_ENTERPRISE_CACHE_PASSWORD'] != null}</storeEnabled>
29+
</remote>
30+
</buildCache>
31+
</gradleEnterprise>

Jenkinsfile

+18-6
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ pipeline {
3232
options { timeout(time: 30, unit: 'MINUTES') }
3333
environment {
3434
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
35+
GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}")
36+
GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}")
3537
TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor'
3638
}
3739
steps {
3840
script {
3941
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
4042
sh 'PROFILE=all-dbs ci/test.sh'
41-
sh "ci/clean.sh"
4243
}
4344
}
4445
}
@@ -61,13 +62,14 @@ pipeline {
6162
options { timeout(time: 30, unit: 'MINUTES')}
6263
environment {
6364
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
65+
GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}")
66+
GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}")
6467
TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor'
6568
}
6669
steps {
6770
script {
6871
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
6972
sh 'PROFILE=all-dbs,hibernate-63-next ci/test.sh'
70-
sh "ci/clean.sh"
7173
}
7274
}
7375
}
@@ -79,13 +81,14 @@ pipeline {
7981
options { timeout(time: 30, unit: 'MINUTES')}
8082
environment {
8183
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
84+
GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}")
85+
GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}")
8286
TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor'
8387
}
8488
steps {
8589
script {
8690
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
8791
sh 'PROFILE=all-dbs ci/test.sh'
88-
sh "ci/clean.sh"
8992
}
9093
}
9194
}
@@ -97,13 +100,14 @@ pipeline {
97100
options { timeout(time: 30, unit: 'MINUTES')}
98101
environment {
99102
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
103+
GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}")
104+
GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}")
100105
TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.jpa.support.ProxyImageNameSubstitutor'
101106
}
102107
steps {
103108
script {
104109
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
105110
sh 'PROFILE=all-dbs,eclipselink-next ci/test.sh'
106-
sh "ci/clean.sh"
107111
}
108112
}
109113
}
@@ -126,19 +130,27 @@ pipeline {
126130

127131
environment {
128132
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
133+
GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}")
134+
GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}")
129135
}
130136

131137
steps {
132138
script {
133139
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
134-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
140+
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ' +
141+
'GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR} ' +
142+
'GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW} ' +
143+
'GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY} ' +
144+
'./mvnw -s settings.xml -Pci,artifactory ' +
135145
'-Dartifactory.server=https://repo.spring.io ' +
136146
"-Dartifactory.username=${ARTIFACTORY_USR} " +
137147
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
138148
"-Dartifactory.staging-repository=libs-snapshot-local " +
139149
"-Dartifactory.build-name=spring-data-jpa " +
140150
"-Dartifactory.build-number=${BUILD_NUMBER} " +
141-
'-Dmaven.test.skip=true clean deploy -U -B'
151+
'-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa-enterprise ' +
152+
'-Dmaven.test.skip=true clean deploy -U -B ' +
153+
'verify -Dorg.slf4j.simpleLogger.log.gradle.goal.cache=debug '
142154
}
143155
}
144156
}

README.adoc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
= 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]]
1+
image:https://spring.io/badges/spring-data-jpa/ga.svg[Spring Data JPA,link=https://projects.spring.io/spring-data-jpa/#quick-start]
2+
image:https://spring.io/badges/spring-data-jpa/snapshot.svg[Spring Data JPA,link=https://projects.spring.io/spring-data-jpa/#quick-start]
3+
4+
= 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"]
25

36
Spring Data JPA, part of the larger https://projects.spring.io/spring-data[Spring Data] family, makes it easy to implement JPA-based repositories.
47
This module deals with enhanced support for JPA-based data access layers.

ci/clean.sh

-6
This file was deleted.

ci/pipeline.properties

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -
2525
docker.registry=
2626
docker.credentials=hub.docker.com-springbuildmaster
2727
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
28+
gradle-enterprise-cache.credentials=gradle_enterprise_cache_user
29+
gradle-enterprise.access-key=gradle_enterprise_secret_access_key

ci/test.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33
set -euo pipefail
44

55
mkdir -p /tmp/jenkins-home/.m2/spring-data-jpa
6+
mkdir -p /tmp/jenkins-home/.m2/.gradle-enterprise
67
chown -R 1001:1001 .
78

9+
export GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USR}
10+
export GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PSW}
11+
export GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY}
12+
813
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \
914
./mvnw -s settings.xml \
10-
-P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa
15+
-P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa
16+
17+
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \
18+
./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa
19+
20+
chown -R 1001:1001 /tmp/jenkins-home/.m2/.gradle-enterprise

pom.xml

+20
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@
221221
</plugin>
222222

223223
</plugins>
224+
225+
<pluginManagement>
226+
<plugins>
227+
<plugin>
228+
<groupId>com.gradle</groupId>
229+
<artifactId>gradle-enterprise-maven-extension</artifactId>
230+
<configuration>
231+
<gradleEnterprise>
232+
<normalization>
233+
<runtimeClassPath>
234+
<ignoredFiles>
235+
<ignoredFile>builddef.lst</ignoredFile>
236+
</ignoredFiles>
237+
</runtimeClassPath>
238+
</normalization>
239+
</gradleEnterprise>
240+
</configuration>
241+
</plugin>
242+
</plugins>
243+
</pluginManagement>
224244
</build>
225245

226246
<repositories>

0 commit comments

Comments
 (0)