commit | 7e3690c91182aa35ec4b468dab9a58a3cd555a07 | [log] [tgz] |
---|---|---|
author | Yun Peng <pcloudy@google.com> | Tue Jan 14 21:58:58 2025 +0100 |
committer | GitHub <noreply@github.com> | Tue Jan 14 21:58:58 2025 +0100 |
tree | 99355b9a22dab94301967ffb2c9ff40228569f7c | |
parent | c9ea6eaa5ed9f57a40178ed1d56cd6510552cd67 [diff] |
Add setup_presubmit_repos.py to reproduce BCR presubmit locally (#3550) This script will create test repos based on presubmit.yml file of given repo and print out commands to reproduce the presubmit builds. Requires https://github.com/bazelbuild/continuous-integration/pull/2155 Fixes https://github.com/bazelbuild/bazel-central-registry/issues/1686 An example run on `protobuf@29.2`: ``` $ bazel run //tools:setup_presubmit_repos -- --module protobuf@29.2 INFO: Invocation ID: 61e8900e-69df-4cb4-82a2-7f6db491c75e INFO: Options provided by the client: Inherited 'common' options: --isatty=1 --terminal_columns=260 INFO: Reading rc options for 'run' from /Users/pcloudy/.bazelrc: Inherited 'build' options: --verbose_failures --announce_rc --disk_cache=/tmp/bazel_disk_cache --repository_cache=/tmp/bazel_repository_cache INFO: Analyzed target //tools:setup_presubmit_repos (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //tools:setup_presubmit_repos up-to-date: bazel-bin/tools/setup_presubmit_repos INFO: Elapsed time: 0.164s, Critical Path: 0.00s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action INFO: Running command line: bazel-bin/tools/setup_presubmit_repos <args omitted> 2025-01-09 14:50:35,148 - INFO: Testing using registry at: /Users/pcloudy/workspace/bazel-central-registry 2025-01-09 14:50:35,151 - INFO: Creating anonymous module repo at: /Users/pcloudy/workspace/bazel-central-registry/temp_test_repos/protobuf/29.2/anonymous_module 2025-01-09 14:50:35,152 - INFO: Anonymous module repo ready at: /Users/pcloudy/workspace/bazel-central-registry/temp_test_repos/protobuf/29.2/anonymous_module To reproduce the build, follow these steps (make sure Bazelisk is installed as bazel): export USE_BAZEL_VERSION=7.x cd /Users/pcloudy/workspace/bazel-central-registry/temp_test_repos/protobuf/29.2/anonymous_module bazel build --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 -- @protobuf//:protobuf @protobuf//:protobuf_lite @protobuf//:protobuf_python @protobuf//:protobuf_java @protobuf//:protoc @protobuf//:test_messages_proto2_cc_proto @protobuf//:test_messages_proto3_cc_proto Make sure to check /Users/pcloudy/workspace/bazel-central-registry/modules/protobuf/29.2/presubmit.yml for additional build and test configurations. 2025-01-09 14:50:35,152 - INFO: Creating test module repo at: /Users/pcloudy/workspace/bazel-central-registry/temp_test_repos/protobuf/29.2/test_module 2025-01-09 14:50:36,439 - INFO: Test module repo ready at: /Users/pcloudy/workspace/bazel-central-registry/temp_test_repos/protobuf/29.2/test_module/output/protobuf-29.2/examples To reproduce the build, follow these steps (make sure Bazelisk is installed as bazel): export USE_BAZEL_VERSION=7.x cd /Users/pcloudy/workspace/bazel-central-registry/temp_test_repos/protobuf/29.2/test_module/output/protobuf-29.2/examples bazel build --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 -- //... Make sure to check /Users/pcloudy/workspace/bazel-central-registry/modules/protobuf/29.2/presubmit.yml for additional build and test configurations. ```
The default Bazel registry for the Bzlmod external dependency system of Bazel. It is the recommended place to find and publish your favorite Bazel projects. Visit https://registry.bazel.build to check what modules are already available!
To contribute, check our BCR policies and contribution guidelines.
The core infrastructure of the Bazel Central Registry depends on GitHub and Google Cloud. Bazel users who enable Bzlmod depend on the BCR by default. While we try to keep the BCR infrastructure simple and reliable, we assume no liability for any damages caused by build failures due to potential BCR infrastructure failures.
If you consider it necessary, you can do the following to avoid depending on the BCR infrastructure while still making use of the information checked into the BCR.
./bazel_registry.json
. You can run bazel run //tools:print_all_src_urls
to get the list of source URLs to mirror for all Bazel modules checked into the BCR. For example, https://foo.com/bar.zip
should be mirrored to https://<your mirror>/foo.com/bar.zip
.