Fix and consolidate repo env handling#28168
Closed
fmeum wants to merge 4 commits intobazelbuild:masterfrom
Closed
Conversation
80c58ce to
d102cd0
Compare
a1cb580 to
f8d127e
Compare
fmeum
commented
Jan 6, 2026
| lastRegistryInvalidation = now; | ||
| } | ||
| return ImmutableList.of( | ||
| PrecomputedValue.injected(PrecomputedValue.REPO_ENV, repoEnvSupplier.get()), |
Collaborator
Author
There was a problem hiding this comment.
This will have to be injected in the appropriate place in Blaze, presumably as an empty map.
94cda6d to
61a843a
Compare
61a843a to
b5a4d2f
Compare
Collaborator
Author
|
@bazel-io fork 9.0.0 |
Wyverald
reviewed
Jan 8, 2026
Member
Wyverald
left a comment
There was a problem hiding this comment.
Overall, this is a very nice cleanup. Thanks for doing this! I don't think I've ever fully understood all the weirdly named repoEnv/repoEnvFromOptions/clientEnvironment stuff, and if I ever thought I understood them, I was probably lying to myself.
src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentVariableValue.java
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/skyframe/RepositoryEnvironmentFunction.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/skyframe/RepositoryEnvironmentFunction.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/skyframe/RepositoryEnvironmentFunction.java
Outdated
Show resolved
Hide resolved
b5a4d2f to
d86e686
Compare
Member
|
I'll import this one myself (due to #28168) EDIT: due to |
Wyverald
pushed a commit
that referenced
this pull request
Jan 9, 2026
The current invalidation logic didn't take `--incompatible_repo_env_ignores_action_env` and `--experimental_strict_repo_env` into account, which resulted in incorrect invalidation of repo rules and module extensions. This is addressed by a larger refactoring that consolidates the logic that computes the effective environment for repository rules and module extensions in `CommandEnvironment`. This environment is then read and sliced by a new `RepoEnvironmentFunction` that operates analogously to `ClientEnvironmentFunction`. Along the way, the variety of terminology in `CommandEnvironment` and various `SkyFunction`s is cleaned up to consistently use: * `repoEnv` to refer to the environment seen by repo rules and module extensions, which may or may not see the full client env based on the value of `--experimental_strict_repo_env` and * `nonstrictRepoEnv`, which refers to same environment with, conceptually, `--experimental_strict_repo_env` forced to `false`. This is used for certain non-hermetic operations such as downloader and credential helper logic. Closes #28168. PiperOrigin-RevId: 854228202 Change-Id: I900f260dd5d0c6e20dcc32eaee0821567e60d5d1
Wyverald
pushed a commit
that referenced
this pull request
Jan 9, 2026
The current invalidation logic didn't take `--incompatible_repo_env_ignores_action_env` and `--experimental_strict_repo_env` into account, which resulted in incorrect invalidation of repo rules and module extensions. This is addressed by a larger refactoring that consolidates the logic that computes the effective environment for repository rules and module extensions in `CommandEnvironment`. This environment is then read and sliced by a new `RepoEnvironmentFunction` that operates analogously to `ClientEnvironmentFunction`. Along the way, the variety of terminology in `CommandEnvironment` and various `SkyFunction`s is cleaned up to consistently use: * `repoEnv` to refer to the environment seen by repo rules and module extensions, which may or may not see the full client env based on the value of `--experimental_strict_repo_env` and * `nonstrictRepoEnv`, which refers to same environment with, conceptually, `--experimental_strict_repo_env` forced to `false`. This is used for certain non-hermetic operations such as downloader and credential helper logic. Closes #28168. PiperOrigin-RevId: 854228202 Change-Id: I900f260dd5d0c6e20dcc32eaee0821567e60d5d1
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 9, 2026
The current invalidation logic didn't take `--incompatible_repo_env_ignores_action_env` and `--experimental_strict_repo_env` into account, which resulted in incorrect invalidation of repo rules and module extensions. This is addressed by a larger refactoring that consolidates the logic that computes the effective environment for repository rules and module extensions in `CommandEnvironment`. This environment is then read and sliced by a new `RepoEnvironmentFunction` that operates analogously to `ClientEnvironmentFunction`. Along the way, the variety of terminology in `CommandEnvironment` and various `SkyFunction`s is cleaned up to consistently use: * `repoEnv` to refer to the environment seen by repo rules and module extensions, which may or may not see the full client env based on the value of `--experimental_strict_repo_env` and * `nonstrictRepoEnv`, which refers to same environment with, conceptually, `--experimental_strict_repo_env` forced to `false`. This is used for certain non-hermetic operations such as downloader and credential helper logic. Closes #28168. PiperOrigin-RevId: 854228202 Change-Id: I900f260dd5d0c6e20dcc32eaee0821567e60d5d1 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current invalidation logic didn't take
--incompatible_repo_env_ignores_action_envand--experimental_strict_repo_envinto account, which resulted in incorrect invalidation of repo rules and module extensions.This is addressed by a larger refactoring that consolidates the logic that computes the effective environment for repository rules and module extensions in
CommandEnvironment. This environment is then read and sliced by a newRepositoryEnvironmentFunctionthat operates analogously toClientEnvironmentFunction.Along the way, the variety of terminology in
CommandEnvironmentand variousSkyFunctions is cleaned up to consistently use:repoEnvto refer to the environment seen by repo rules and module extensions, which may or may not see the full client env based on the value of--experimental_strict_repo_envandmodifiedClientEnv, which refers to same environment with, conceptually,--experimental_strict_repo_envforced tofalse. This is used for certain non-hermetic operations such as downloader and credential helper logic.