Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copying MODULE.bazel with no write permission #1844

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion buildkite/bazel-central-registry/bcr_presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ def prepare_test_module_repo(module_name, module_version):
# Make sure the checked-in MODULE.bazel file is used.
checked_in_module_dot_bazel = get_module_dot_bazel(module_name, module_version)
bazelci.eprint("\n* Copy checked-in MODULE.bazel file to source root:\n%s\n" % read(checked_in_module_dot_bazel))
shutil.copy(checked_in_module_dot_bazel, source_root.joinpath("MODULE.bazel"))
module_dot_bazel = source_root.joinpath("MODULE.bazel")
# In case the existing MODULE.bazel has no write permission.
if module_dot_bazel.exists():
os.remove(module_dot_bazel)
shutil.copy(checked_in_module_dot_bazel, module_dot_bazel)

# Generate the presubmit.yml file for the test module, it should be the content under "bcr_test_module"
orig_presubmit = yaml.safe_load(open(get_presubmit_yml(module_name, module_version), "r"))
Expand Down
Loading