Skip to content

Commit 6fcb0d5

Browse files
committed
Don't use the build cache during releases
So that we're extra sure we're not relying on cache left by a previous Gradle execution. (cherry picked from commit 543e095)
1 parent 222b1a2 commit 6fcb0d5

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

ci/release/Jenkinsfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ pipeline {
135135
// update changelog from JIRA
136136
// tags the version
137137
// changes the version to the provided development version
138-
withEnv(["BRANCH=${env.GIT_BRANCH}"]) {
138+
withEnv([
139+
"BRANCH=${env.GIT_BRANCH}",
140+
"DISABLE_REMOTE_GRADLE_CACHE=true"
141+
]) {
139142
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
140143
}
141144
}
@@ -161,7 +164,11 @@ pipeline {
161164
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
162165
// performs documentation upload and Sonatype release
163166
// push to github
164-
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
167+
withEnv([
168+
"DISABLE_REMOTE_GRADLE_CACHE=true"
169+
]) {
170+
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
171+
}
165172
}
166173
}
167174
}

ci/snapshot-publish.Jenkinsfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,20 @@ pipeline {
3737
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_PASS'),
3838
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_KEYRING')
3939
]) {
40-
sh '''./gradlew clean publish \
41-
-PhibernatePublishUsername=$hibernatePublishUsername \
42-
-PhibernatePublishPassword=$hibernatePublishPassword \
43-
-Pgradle.publish.key=$hibernatePluginPortalUsername \
44-
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
45-
--no-scan \
46-
-DsigningPassword=$SIGNING_PASS \
47-
-DsigningKeyFile=$SIGNING_KEYRING \
48-
'''
40+
withEnv([
41+
"DISABLE_REMOTE_GRADLE_CACHE=true"
42+
]) {
43+
sh '''./gradlew clean publish \
44+
-PhibernatePublishUsername=$hibernatePublishUsername \
45+
-PhibernatePublishPassword=$hibernatePublishPassword \
46+
-Pgradle.publish.key=$hibernatePluginPortalUsername \
47+
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
48+
--no-scan \
49+
--no-build-cache \
50+
-DsigningPassword=$SIGNING_PASS \
51+
-DsigningKeyFile=$SIGNING_KEYRING \
52+
'''
53+
}
4954
}
5055
}
5156
}

gradle/gradle-enterprise.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
ext {
1313
isCiEnvironment = isJenkins() || isGitHubActions() || isGenericCi()
14-
populateRemoteBuildCache = getSetting( "POPULATE_REMOTE" ).isPresent()
14+
populateRemoteBuildCache = isEnabled( "POPULATE_REMOTE" )
15+
useRemoteCache = !isEnabled( "DISABLE_REMOTE_GRADLE_CACHE" )
1516
}
1617

1718
private static boolean isJenkins() {
@@ -36,6 +37,14 @@ static java.util.Optional<String> getSetting(String name) {
3637
return java.util.Optional.ofNullable(sysProp);
3738
}
3839

40+
static boolean isEnabled(String setting) {
41+
if ( System.getenv().hasProperty( setting ) ) {
42+
return true
43+
}
44+
45+
return System.hasProperty( setting )
46+
}
47+
3948
gradleEnterprise {
4049
server = 'https://ge.hibernate.org'
4150

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ buildCache {
287287
enabled = !settings.ext.isCiEnvironment
288288
}
289289
remote(HttpBuildCache) {
290-
enabled = true
290+
enabled = settings.ext.useRemoteCache
291291
// Check access key presence to avoid build cache errors on PR builds when access key is not present
292292
def accessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY")
293293
push = settings.ext.populateRemoteBuildCache && accessKey

0 commit comments

Comments
 (0)