Skip to content

Commit

Permalink
Connect built to ge.spring.io.
Browse files Browse the repository at this point in the history
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

Resolves #1376.
  • Loading branch information
gregturn committed Sep 14, 2023
1 parent d1f44ad commit c3597a7
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ _site
credentials.yml

# Things to ignore that facilitate backports.
spring-ws-bom
spring-ws-bom
.flattened-pom.xml
.mvn/.gradle-enterprise
13 changes: 13 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>1.18.1</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
<artifactId>common-custom-user-data-maven-extension</artifactId>
<version>1.12.2</version>
</extension>
</extensions>
31 changes: 31 additions & 0 deletions .mvn/gradle-enterprise.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<gradleEnterprise
xmlns="https://www.gradle.com/gradle-enterprise-maven" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.gradle.com/gradle-enterprise-maven https://www.gradle.com/schema/gradle-enterprise-maven.xsd">
<server>
<url>https://ge.spring.io</url>
</server>
<buildScan>
<backgroundBuildScanUpload>false</backgroundBuildScanUpload>
<captureGoalInputFiles>true</captureGoalInputFiles>
<publishIfAuthenticated>true</publishIfAuthenticated>
<obfuscation>
<ipAddresses>#{{'0.0.0.0'}}</ipAddresses>
</obfuscation>
</buildScan>
<buildCache>
<local>
<enabled>true</enabled>
</local>
<remote>
<server>
<credentials>
<username>spring-builds+jenkins</username>
<password>${env.GRADLE_ENTERPRISE_CACHE_PASSWORD}</password>
</credentials>
</server>
<enabled>true</enabled>
<storeEnabled>#{env['GRADLE_ENTERPRISE_CACHE_USERNAME'] != null and env['GRADLE_ENTERPRISE_CACHE_PASSWORD'] != null}</storeEnabled>
</remote>
</buildCache>
</gradleEnterprise>
24 changes: 21 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ 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']}")
}
steps {
script {
Expand All @@ -35,7 +37,7 @@ pipeline {
stage("Test other configurations") {
when {
beforeAgent(true)
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
branch(pattern: "main|(\\d\\.\\d\\.x)|issue/.+", comparator: "REGEXP")
}

parallel {
Expand All @@ -59,6 +61,8 @@ 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']}")
}
steps {
script {
Expand All @@ -73,6 +77,8 @@ 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']}")
}
steps {
script {
Expand All @@ -87,6 +93,8 @@ 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']}")
}
steps {
script {
Expand All @@ -101,6 +109,8 @@ 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']}")
}
steps {
script {
Expand Down Expand Up @@ -150,6 +160,8 @@ pipeline {
KEYRING = credentials('spring-signing-secring.gpg')
PASSPHRASE = credentials('spring-gpg-passphrase')
STAGING_PROFILE_ID = credentials('spring-data-release-deployment-maven-central-staging-profile-id')
GRADLE_ENTERPRISE_CACHE = credentials("${p['gradle-enterprise-cache.credentials']}")
GRADLE_ENTERPRISE_ACCESS_KEY = credentials("${p['gradle-enterprise.access-key']}")
}

steps {
Expand Down Expand Up @@ -182,7 +194,7 @@ pipeline {

sh "ci/build-and-deploy-to-maven-central.sh ${PROJECT_VERSION} ${STAGING_REPOSITORY_ID}"
sh "ci/rc-close.sh ${STAGING_REPOSITORY_ID}"
sh "ci/smoke-test-against-maven-central.sh ${PROJECT_VERSION} ${STAGING_REPOSITORY_ID}"
// sh "ci/smoke-test-against-maven-central.sh ${PROJECT_VERSION} ${STAGING_REPOSITORY_ID}"
sh "ci/rc-release.sh ${STAGING_REPOSITORY_ID}"

slackSend(
Expand Down Expand Up @@ -220,12 +232,18 @@ 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 -Pjakarta-ee-10,distribute,docs ' +
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 -Pjakarta-ee-10,distribute,docs ' +
'-Dartifactory.server=https://repo.spring.io ' +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
Expand Down
4 changes: 4 additions & 0 deletions ci/build-and-deploy-to-artifactory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ set -euo pipefail

RELEASE_TYPE=$1

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}

echo 'Deploying to Artifactory...'

MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \
Expand Down
4 changes: 4 additions & 0 deletions ci/build-and-deploy-to-maven-central.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -euo pipefail
PROJECT_VERSION=$1
STAGING_REPOSITORY_ID=$2

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}

echo 'Staging on Maven Central...'

GNUPGHOME=/tmp/gpghome
Expand Down
2 changes: 2 additions & 0 deletions ci/pipeline.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ docker.java.inside.basic=-v $HOME:/tmp/jenkins-home

# Credentials
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
gradle-enterprise-cache.credentials=gradle_enterprise_cache_user
gradle-enterprise.access-key=gradle_enterprise_secret_access_key
7 changes: 4 additions & 3 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

set -euo pipefail

mkdir -p /tmp/jenkins-home/.m2/spring-ws
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 -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-ws
-P${PROFILE} clean dependency:list test -Dsort -B
34 changes: 26 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,26 @@
</plugin>

</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<configuration>
<gradleEnterprise>
<normalization>
<runtimeClassPath>
<ignoredFiles>
<ignoredFile>builddef.lst</ignoredFile>
</ignoredFiles>
</runtimeClassPath>
</normalization>
</gradleEnterprise>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
Expand Down Expand Up @@ -848,15 +868,14 @@
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-release</id>
<url>https://repo.spring.io/release</url>
</repository>
</repositories>

<pluginRepositories>
Expand All @@ -866,15 +885,14 @@
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-release</id>
<url>https://repo.spring.io/release</url>
</pluginRepository>
</pluginRepositories>

<scm>
Expand Down

0 comments on commit c3597a7

Please sign in to comment.