Skip to content

Commit

Permalink
Disable local build cache on CI (#6700)
Browse files Browse the repository at this point in the history
From https://docs.gradle.org/8.5/userguide/build_cache.html#sec:build_cache_configure:
> Gradle tries to load build outputs from the local build cache first, and
> then tries the remote build cache if no build outputs are found. If
> outputs are found in the remote cache, they are also stored in the local
> cache, so next time they will be found locally.

Inversely this means that that when local cache is hit, the outputs will
not be stored in the remote cache. This is not what we want on CI nodes.
Forcing remote build cache only on CI means cache will be updated for every
task that does not have outputs already stored in the remote cache. This
ensures they're available for local dev builds.
  • Loading branch information
3flex committed Apr 9, 2024
1 parent 206f080 commit d643652
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ val isCiBuild = providers.environmentVariable("CI").isPresent

buildCache {
local {
isEnabled = true
isEnabled = !isCiBuild
}
remote<HttpBuildCache> {
isPush = isCiBuild
Expand Down
2 changes: 1 addition & 1 deletion detekt-gradle-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ val isCiBuild = providers.environmentVariable("CI").isPresent

buildCache {
local {
isEnabled = true
isEnabled = !isCiBuild
}
remote<HttpBuildCache> {
isPush = isCiBuild
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ develocity {

buildCache {
local {
isEnabled = true
isEnabled = !isCiBuild
}
remote(develocity.buildCache) {
isEnabled = true
Expand Down

0 comments on commit d643652

Please sign in to comment.