bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.14k stars 4.05k forks source link

bzlmod mod commands don't support flags that affect repo generation #24070

Open rickeylev opened 2 hours ago

rickeylev commented 2 hours ago

Description of the feature request:

When --action_env is used to set environment variables to affect what repos are generated, bazel mod commands will fail.

Stated more specifically: in rules_python, in a bazel-in-bazel integration test, we pass --action_env=RULES_PYTHON_REPO_DEBUG=1. When this env var is set, it causes our bzlmod extension to generate an extra repo with debugging information in it. If not set, then the repo isn't generated. Unfortunately, the bazel mod command doesn't support --action_env. The net effect is use_repo() in the MODULE file references a repo that doesn't exist, and the mod command fails entirely.

Which category does this issue belong to?

No response

What underlying problem are you trying to solve with this feature?

To make it easy to have the same looking invocation between commands. Similarly, flags that could affect the module phase should also be supported by the mod command (similar to query vs cquery)

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

7.3.2

If bazel info release returns development 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 HEAD ?

No response

Have you found anything relevant by searching the web?

A quick search of github didn't show anything

Any other information, logs, or outputs that you want to share?

No response

fmeum commented 2 hours ago

(Not directly related, but using --repo_env for this is better as it doesn't leak into actions. It's probably still affected by this bug though.)