[9.0.0] Fix and consolidate repo env handling #28205
Merged
+459
−268
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 newRepoEnvironmentFunctionthat 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_envandnonstrictRepoEnv, 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.Closes #28168.
PiperOrigin-RevId: 854228202
Change-Id: I900f260dd5d0c6e20dcc32eaee0821567e60d5d1