Skip to content

Commit

Permalink
Don't use the build cache during releases
Browse files Browse the repository at this point in the history
So that we're extra sure we're not relying on cache left by a previous
Gradle execution.
  • Loading branch information
beikov authored and yrodiere committed Oct 25, 2024
1 parent 3b51f85 commit 0f5dd4d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
7 changes: 6 additions & 1 deletion ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pipeline {
// changes the version to the provided development version
withEnv([
"BRANCH=${env.GIT_BRANCH}",
"DISABLE_REMOTE_GRADLE_CACHE=true",
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
"GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'"
]) {
Expand Down Expand Up @@ -206,7 +207,11 @@ pipeline {
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
// performs documentation upload and Sonatype release
// push to github
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
withEnv([
"DISABLE_REMOTE_GRADLE_CACHE=true"
]) {
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
}
}
}
}
Expand Down
23 changes: 14 additions & 9 deletions ci/snapshot-publish.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,20 @@ pipeline {
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_PASS'),
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_KEYRING')
]) {
sh '''./gradlew clean publish \
-PhibernatePublishUsername=$hibernatePublishUsername \
-PhibernatePublishPassword=$hibernatePublishPassword \
-Pgradle.publish.key=$hibernatePluginPortalUsername \
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
--no-scan \
-DsigningPassword=$SIGNING_PASS \
-DsigningKeyFile=$SIGNING_KEYRING \
'''
withEnv([
"DISABLE_REMOTE_GRADLE_CACHE=true"
]) {
sh '''./gradlew clean publish \
-PhibernatePublishUsername=$hibernatePublishUsername \
-PhibernatePublishPassword=$hibernatePublishPassword \
-Pgradle.publish.key=$hibernatePluginPortalUsername \
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
--no-scan \
--no-build-cache \
-DsigningPassword=$SIGNING_PASS \
-DsigningKeyFile=$SIGNING_KEYRING \
'''
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions gradle/gradle-develocity.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ext {
isCiEnvironment = isJenkins() || isGitHubActions() || isGenericCi()
populateRemoteBuildCache = isEnabled( "POPULATE_REMOTE_GRADLE_CACHE" )
useRemoteCache = !isEnabled( "DISABLE_REMOTE_GRADLE_CACHE" )
}

private static boolean isJenkins() {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ buildCache {
enabled = !settings.ext.isCiEnvironment
}
remote(develocity.buildCache) {
enabled = true
enabled = settings.ext.useRemoteCache
// Check access key presence to avoid build cache errors on PR builds when access key is not present
def accessKey = System.getenv("DEVELOCITY_ACCESS_KEY")
push = settings.ext.populateRemoteBuildCache && accessKey
Expand Down

0 comments on commit 0f5dd4d

Please sign in to comment.