forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict bazelrc-set flag aliases to the "build" command.
This prevents being able to build with an alias that "$ bazel canonicalize-flags" doesn't understand. This is a safety check for build and CI pipelines that process invocation flags through canonicalize-flags. Example scenario this fixes: $ cat .bazelrc test --flag_alias=myalias=//foo build:myconfig --flag_alias=configalias=//foo build:myconfig --configalias=5 $ bazel test //:mytest --myalias=blah <succeeds> $ bazel canonicalize-flags --for_command=test -- --myalias=blah ERROR: Unrecognized option: --myalias=blah $ bazel build //:mybuild --config=myconfig <succeeds> $ bazel canonicalize-flags -- --configalias=4 ERROR: Unrecognized option: --configalias=4 We could potentially expand CanonicalizeCommand.java to inherit from TestCommand.class instead of BuildCommand.class if there was a use case for loosening this restriction. PiperOrigin-RevId: 374867565
- Loading branch information
1 parent
9732d23
commit 329b22a
Showing
2 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters