Repository navigation
Make the Gradle build cache read-only by default - #509
Merged
Merged
Conversation
…n reach the proxy can no longer overwrite cache entries; CI jobs that upload now need gradle.build_cache.read_only: false (or PROXY_GRADLE_BUILD_CACHE_READ_ONLY=false). The environment variable is parsed strictly, so a value like "yes" keeps uploads off and logs a warning instead of opening them. Fixes git-pkgs#497.
pinguinfuss
marked this pull request as ready for review
October 18, 2026 11:03
andrew
approved these changes
Oct 18, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
The read-only default, explicit upload opt-in, and strict environment parsing are covered by configuration and HTTP server tests. The configuration documentation explains the changed default for existing upload setups.
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #497.
gradle.build_cache.read_onlynow defaults totrue, so a client that can reach the proxy can't PUT to/gradle/and overwrite cache entries that end up in other people's builds. GET and HEAD work as before.This is a breaking change for setups that upload to the cache: set
read_only: false(orPROXY_GRADLE_BUILD_CACHE_READ_ONLY=false) on the instance your CI jobs push to.docs/configuration.mddescribes this, and the README and dashboard snippets now push only from CI (isPush = System.getenv("CI") != null, Kotlin DSL).PROXY_GRADLE_BUILD_CACHE_READ_ONLYis parsed strictly. The sharedenvBooltreats anything other thantrue/1as false, so with the new default a value likeyesorTRUEwould have opened uploads. The variable now accepts whatstrconv.ParseBoolaccepts; any other value keeps the cache read-only and logs a warning at startup. The other boolean variables are unchanged.Tests cover the new default, a config file with a partial
build_cacheblock, the environment values, and the server wiring (PUT returns 405 by default and 201 withread_only: false).