-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Provide alternative to --action_env which doesn't force a rebuild when changed #7466
Comments
As worded, this feature sounds very dangerous. You would be modifying action execution invisibly, making cached actions non-hermetic. You talk about a wrapper, but then about |
By "build wrapper" I mean the Coverity static analysis tool. When running Coverity you tell it the build command (eg "bazel build //target") and it runs and monitors that command. I'm not sure excactly how the monitoring works, but it requires various environment variables to be passed to the compiler (eg COVERITY_TEMP). They don't affect the output of the build. |
Oh I see. I misread the So... are you sure this is working? Bazel spawns a server in the background the first time it runs and will reuse the server in future invocations. I don't think running Coverity on Bazel when the server is already running will have any effect, because Coverity won't have any visibility on the server process. Maybe that's why you are seeing trouble. Try with Can you provide a specific example of what works and what doesn't? It is not clear to me what you pass to Also, you said that (Note: it doesn't matter if these variables don't affect the output of the build: exposing a flag to do what you say would be dangerous because people will pass environment variables that do affect the behavior of the build without knowing what the consequences are.) |
It works on Linux with the bazel server already running, but on Windows I need to run "bazel shutdown" before cov-build so a new instance of the server starts up within its monitoring environment. The cov-build wrapper sets the environment variables, and the compiler (eg gcc) needs to see them, or Coverity isn't able analyse the source being compiled. I guess it hooks or replaces the compiler binary somehow. |
Again, please provide specific command lines. |
To run the build with Coverity doing static analysis: Bazel will execute gcc as normal. cov-build sets a number of environment variables, but these are the one that cause a problem because they have different values each time we run it:
|
I mean the Bazel invocations. What exactly are you invoking? I.e. what |
Sorry, I had them in .bazelrc. I'm not sure if this is the definitive list. The LD_PRELOAD is how it hooks the compiler. I've also been using --spawn_strategy=standalone. It does work like this, just forcing full rebuilds every time.
|
Oh sorry, I see where my confusion was coming from. The description for
and the first line implies that the values are |
@StephenWassell One potential way around this could be by using volatile stamp values: https://docs.bazel.build/versions/master/user-manual.html#workspace_status |
Is this maybe solved by |
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 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
Description of the problem / feature request:
It would be very useful to have a command line option that works like --action_env to pass environment variables through to the compiler actions, but without invalidating the target if they are changed.
Feature requests: what underlying problem are you trying to solve with this feature?
We need this to run Bazel with the Coverity static code analysis tool. It works as a build wrapper, for example:
$ cov-build --dir cov-output-dir bazel build ...
The cov-build command sets various environment variables which need to be passed through to the compiler, but some are different for each build, such as COVERITY_TEMP which is set to a randomly named temporary directory. Without using --action_env the Coverity analysis doesn't happen; with --action_env it works but forces a full rebuild each time.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
n/a
What operating system are you running Bazel on?
Linux, Windows
What's the output of
bazel info release
?release 0.22.0
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.n/a
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?n/a
Have you found anything relevant by searching the web?
No, I don't think many people have tried running Bazel and Coverity together.
Any other information, logs, or outputs that you want to share?
n/a
The text was updated successfully, but these errors were encountered: