Skip to content

Commit 1f2961a

Browse files
meteorcloudybazel-io
authored andcommittedNov 2, 2023
Automated rollback of commit fc3460e.
*** Reason for rollback *** Due to bazelbuild#19749 *** Original change description *** Stablize and flip repository_cache_urls_as_default_canonical_id 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 r... *** RELNOTES: None PiperOrigin-RevId: 578840189 Change-Id: I390910b5dd838a4a1384c5d24cedde0b7c1b2b98
1 parent 8f44ab7 commit 1f2961a

File tree

6 files changed

+6
-54
lines changed

6 files changed

+6
-54
lines changed
 

‎scripts/bootstrap/bootstrap.sh

-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ fi
3131

3232
: ${JAVA_VERSION:="11"}
3333

34-
# TODO: remove `norepository_cache_urls_as_default_canonical_id` once all dependencies are mirrored.
35-
# See https://github.com/bazelbuild/bazel/pull/19549 for more context.
3634
_BAZEL_ARGS="--spawn_strategy=standalone \
3735
--nojava_header_compilation \
3836
--strategy=Javac=worker --worker_quit_after_build --ignore_unsupported_sandboxing \
3937
--compilation_mode=opt \
4038
--repository_cache=derived/repository_cache \
41-
--norepository_cache_urls_as_default_canonical_id \
4239
--extra_toolchains=//scripts/bootstrap:all \
4340
--extra_toolchains=@bazel_tools//tools/python:autodetecting_toolchain \
4441
--enable_bzlmod \

‎src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,8 @@ public Converter() {
263263
public CheckDirectDepsMode checkDirectDependencies;
264264

265265
@Option(
266-
name = "repository_cache_urls_as_default_canonical_id",
267-
oldName = "experimental_repository_cache_urls_as_default_canonical_id",
268-
defaultValue = "true",
266+
name = "experimental_repository_cache_urls_as_default_canonical_id",
267+
defaultValue = "false",
269268
documentationCategory = OptionDocumentationCategory.BAZEL_CLIENT_OPTIONS,
270269
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
271270
metadataTags = {OptionMetadataTag.EXPERIMENTAL},

‎src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java

-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ public void setup(BlackBoxTestContext context) throws IOException {
7878
String sharedRepoCache = System.getenv("REPOSITORY_CACHE");
7979
if (sharedRepoCache != null) {
8080
lines.add("common --repository_cache=" + sharedRepoCache);
81-
// TODO(sluongng): Remove this flag once all dependencies are mirrored.
82-
// See https://github.com/bazelbuild/bazel/pull/19549 for more context.
83-
lines.add("common --norepository_cache_urls_as_default_canonical_id");
8481
if (OS.getCurrent() == OS.DARWIN) {
8582
// For reducing SSD usage on our physical Mac machines.
8683
lines.add("common --experimental_repository_cache_hardlinks");

‎src/test/py/bazel/test_base.py

-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ def setUp(self):
127127
shared_repo_cache = os.environ.get('REPOSITORY_CACHE')
128128
if shared_repo_cache:
129129
f.write('common --repository_cache={}\n'.format(shared_repo_cache))
130-
# TODO(sluongng): Remove this flag once all dependencies are mirrored.
131-
# See https://github.com/bazelbuild/bazel/pull/19549 for more context.
132-
f.write('common --norepository_cache_urls_as_default_canonical_id\n')
133130
if TestBase.IsDarwin():
134131
# For reducing SSD usage on our physical Mac machines.
135132
f.write('common --experimental_repository_cache_hardlinks\n')

‎src/test/shell/bazel/bazel_repository_cache_test.sh

+4-39
Original file line numberDiff line numberDiff line change
@@ -494,18 +494,18 @@ EOF
494494
|| echo "Expected fetch to succeed"
495495
}
496496

497-
function test_repository_cache_urls_as_default_canonical_id() {
497+
function test_experimental_repository_cache_urls_as_default_canonical_id() {
498498
setup_repository
499499

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

505505
shutdown_server
506506

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

@@ -524,44 +524,9 @@ EOF
524524

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

532-
function test_repository_legacy_default_canonical_id() {
533-
setup_repository
534-
535-
bazel fetch --repository_cache="$repo_cache_dir" \
536-
--norepository_cache_urls_as_default_canonical_id \
537-
//zoo:breeding-program >& $TEST_log \
538-
|| echo "Expected fetch to succeed"
539-
540-
shutdown_server
541-
542-
bazel fetch --repository_cache="$repo_cache_dir" \
543-
--norepository_cache_urls_as_default_canonical_id \
544-
//zoo:breeding-program >& $TEST_log \
545-
|| echo "Expected fetch to succeed"
546-
547-
# Break url in WORKSPACE
548-
rm WORKSPACE
549-
cat >> $(create_workspace_with_default_repos WORKSPACE) <<EOF
550-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
551-
552-
http_archive(
553-
name = 'endangered',
554-
url = 'http://localhost:$nc_port/bleh.broken',
555-
sha256 = '$sha256',
556-
type = 'zip',
557-
)
558-
EOF
559-
560-
# As repository cache key should depend on urls, we expect fetching to fail now.
561-
bazel fetch --repository_cache="$repo_cache_dir" \
562-
--norepository_cache_urls_as_default_canonical_id \
563-
//zoo:breeding-program >& $TEST_log \
564-
|| echo "Expected fetch to succeed"
565-
}
566-
567532
run_suite "repository cache tests"

‎src/test/shell/testenv.sh.tmpl

-3
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,6 @@ EOF
327327
if [[ -n ${REPOSITORY_CACHE:-} ]]; then
328328
echo "testenv.sh: Using repository cache at $REPOSITORY_CACHE."
329329
echo "common --repository_cache=$REPOSITORY_CACHE" >> $TEST_TMPDIR/bazelrc
330-
# TODO(sluongng): Remove this flag once all dependencies are mirrored.
331-
# See https://github.com/bazelbuild/bazel/pull/19549 for more context.
332-
echo "common --norepository_cache_urls_as_default_canonical_id" >> $TEST_TMPDIR/bazelrc
333330
if is_darwin; then
334331
# For reducing SSD usage on our physical Mac machines.
335332
echo "testenv.sh: Enabling --experimental_repository_cache_hardlinks"

0 commit comments

Comments
 (0)
Please sign in to comment.