-
Notifications
You must be signed in to change notification settings - Fork 4k
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
--config in .bazelrc doesn't appear to follow build to test inheritance #15845
Comments
With inheritance, precedence depends on specificity. Commands such as test and release inherit flags from build. The inheriting command is said to be more specific and thus the associated flags take precedence https://docs.bazel.build/versions/main/guide.html#bazelrc-syntax-and-semantics. So in this case because you have What were you trying to achieve with defining a test config |
@aranguyen The above is simplified to show the slightly odd behavior. Our actual use case for this was this: When doing local development, we wanted
On CI, rather than adding
This turned out to not work. Running
Since the docs say the home
If I understand you correctly, Bazel instead does something like this:
|
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
Description of the bug:
We are using a config flag (
--config=ci
) to override some defaults from the workspace-level .bazelrc on CI. We set this on CI in the home~/.bazelrc
asbuild --config=ci
.We are seeing Bazel pick defaults instead of overrides when the command being run is
bazel test
. It works as expected withbazel build
. Switching the command in~/.bazelrc
totest
also works as expected.We have a minimal reproducer described below.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSPACE:
BUILD.bazel:
.bazelrc
(workspace level):~/.bazelrc
(home directory):Run
bazel test demo
. Colors are disabled. We expected colors to be on, sincetest
inherits frombuild
, and--config=ci
is set forbuild
, and the workspace level RC file enables colors for test when--config=ci
is enabled.Workarounds
build
totest
in the home.bazelrc
, or just setting the config for bothbuild
andtest
.--config=ci
explicitly when invoking Bazel.test
tobuild
in the workspace.bazelrc
and runningbuild
instead also causes colors to be enabled.Which operating system are you running Bazel on?
MacOS Monterey
What is the output of
bazel info release
?6.0.0-pre.20220608.2
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: