Skip to content

Commit

Permalink
bcr_presubmit: pass --check_direct_dependencies=off for test module i…
Browse files Browse the repository at this point in the history
…f bazel version is overridden
  • Loading branch information
meteorcloudy committed Dec 6, 2024
1 parent a743628 commit 0d32ae7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions buildkite/bazel-central-registry/bcr_presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def unpack_archive(archive_file, output_dir):
else:
shutil.unpack_archive(archive_file, output_dir)

def prepare_test_module_repo(module_name, module_version):
def prepare_test_module_repo(module_name, module_version, overwrite_bazel_version=None):
"""Prepare the test module repo and the presubmit yml file it should use"""
bazelci.print_collapsed_group(":information_source: Prepare test module repo")
root = pathlib.Path(bazelci.get_repositories_root())
Expand Down Expand Up @@ -271,8 +271,9 @@ def prepare_test_module_repo(module_name, module_version):
scratch_file(test_module_root, ".bazelrc", [
# .bazelrc may not end with a newline.
"",
"build --experimental_enable_bzlmod",
"build --registry=%s" % BCR_REPO_DIR.as_uri(),
"common --experimental_enable_bzlmod",
"common --registry=%s" % BCR_REPO_DIR.as_uri(),
"common --check_direct_dependencies=off" if overwrite_bazel_version else "",
], mode="a")
bazelci.eprint("* Append Bzlmod flags to .bazelrc file:\n%s\n" % read(test_module_root.joinpath(".bazelrc")))

Expand Down Expand Up @@ -523,7 +524,7 @@ def main(argv=None):
config_file = get_presubmit_yml(args.module_name, args.module_version)
return run_test(repo_location, config_file, args.task, args.overwrite_bazel_version)
elif args.subparsers_name == "test_module_runner":
repo_location, config_file = prepare_test_module_repo(args.module_name, args.module_version)
repo_location, config_file = prepare_test_module_repo(args.module_name, args.module_version, args.overwrite_bazel_version)
return run_test(repo_location, config_file, args.task, args.overwrite_bazel_version)
else:
parser.print_help()
Expand Down

0 comments on commit 0d32ae7

Please sign in to comment.