Skip to content

Commit

Permalink
Stablize and flip repository_cache_urls_as_default_canonical_id
Browse files Browse the repository at this point in the history
Introduced in bazelbuild#14268, this flag is very useful for bigger enterprise
context where folks often version bumping dependencies without
remembering to update the SHA256 of the downloaded file, leading to
Bazel picking up older download entries from the repository cache.

As we get more questions about this flag in Slack, marking it as
stable and flip the default seems to be the right move.
  • Loading branch information
sluongng committed Sep 18, 2023
1 parent 32563ca commit fff3b9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,9 @@ public Converter() {
public CheckDirectDepsMode checkDirectDependencies;

@Option(
name = "experimental_repository_cache_urls_as_default_canonical_id",
defaultValue = "false",
name = "repository_cache_urls_as_default_canonical_id",
oldName = "experimental_repository_cache_urls_as_default_canonical_id",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.BAZEL_CLIENT_OPTIONS,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
Expand Down
8 changes: 4 additions & 4 deletions src/test/shell/bazel/bazel_repository_cache_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -494,18 +494,18 @@ EOF
|| echo "Expected fetch to succeed"
}

function test_experimental_repository_cache_urls_as_default_canonical_id() {
function test_repository_cache_urls_as_default_canonical_id() {
setup_repository

bazel fetch --repository_cache="$repo_cache_dir" \
--experimental_repository_cache_urls_as_default_canonical_id \
--repository_cache_urls_as_default_canonical_id \
//zoo:breeding-program >& $TEST_log \
|| echo "Expected fetch to succeed"

shutdown_server

bazel fetch --repository_cache="$repo_cache_dir" \
--experimental_repository_cache_urls_as_default_canonical_id \
--repository_cache_urls_as_default_canonical_id \
//zoo:breeding-program >& $TEST_log \
|| echo "Expected fetch to succeed"

Expand All @@ -524,7 +524,7 @@ EOF

# As repository cache key should depend on urls, we expect fetching to fail now.
bazel fetch --repository_cache="$repo_cache_dir" \
--experimental_repository_cache_urls_as_default_canonical_id \
--repository_cache_urls_as_default_canonical_id \
//zoo:breeding-program >& $TEST_log \
&& fail "expected failure" || :
}
Expand Down

0 comments on commit fff3b9e

Please sign in to comment.