Disable bwc distribution caching in master branch (#46686)
This commit disables caching of BWC snapshot distributions in the "trunk" (aka master) branch. Since the previous major release branches move quickly we rarely get cache hits for these tasks, and the artifacts themselves are very large. This means the overhead here is high and savings basically zero. We conditionally disable task output caching in this scenario in CI to avoid excessive build cache overhead as well as causing too much turn in the cache itself which would lead to lots of cache entry evictions.
This commit is contained in:
parent
02a5e153dc
commit
507d879b70
|
@ -95,6 +95,7 @@ public class GlobalBuildInfoPlugin implements Plugin<Project> {
|
|||
ext.set("gradleJavaVersion", Jvm.current().getJavaVersion());
|
||||
ext.set("gitRevision", gitRevision(project.getRootProject().getRootDir()));
|
||||
ext.set("buildDate", ZonedDateTime.now(ZoneOffset.UTC));
|
||||
ext.set("isCi", System.getenv("JENKINS_URL") != null);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -223,8 +223,14 @@ bwcVersions.forPreviousUnreleased { BwcVersions.UnreleasedVersionInfo unreleased
|
|||
Task bwcTask = createRunBwcGradleTask(buildBwcTaskName(projectName)) {
|
||||
inputs.file("${project.buildDir}/refspec")
|
||||
outputs.files(projectArtifact)
|
||||
outputs.cacheIf { true }
|
||||
outputs.cacheIf("BWC distribution caching is disabled on 'master' branch") {
|
||||
// Don't bother caching in 'master' since the BWC branches move too quickly to make this cost worthwhile
|
||||
project.ext.isCi && System.getenv('GIT_BRANCH')?.endsWith("master") == false
|
||||
}
|
||||
args ":${projectDir.replace('/', ':')}:assemble"
|
||||
if (project.gradle.startParameter.buildCacheEnabled) {
|
||||
args "--build-cache"
|
||||
}
|
||||
doLast {
|
||||
if (projectArtifact.exists() == false) {
|
||||
throw new InvalidUserDataException("Building ${bwcVersion} didn't generate expected file ${projectArtifact}")
|
||||
|
|
Loading…
Reference in New Issue