-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[8.4.0] Add --module_mirrors
#26850
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
Merged
Merged
[8.4.0] Add --module_mirrors
#26850
Conversation
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
The new flag allows users to specify additional mirrors for Bazel registry source URLs, taking precedence over those specified by registries. This provides a way to add mirrors without changing `bazel_registry.json`, the hash of which is stored in lockfiles. RELNOTES: The new `--module_mirrors` flag accepts a comma-separated list of mirrors to use for source URLs provided by modules obtained from Bazel registries. Closes bazelbuild#26832. PiperOrigin-RevId: 800384242 Change-Id: I3b56eb5fe0405f460568d7563b2ad93f6b7461a5
Member
|
@fmeum Something weird with 8.4.0, can you take a look? |
Collaborator
|
@meteorcloudy Could you apply this patch? diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java
index 0b44c3fad4..7bf0e83585 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java
@@ -177,6 +177,7 @@ public class BazelModuleResolutionFunctionTest extends FoundationTestCase {
PrecomputedValue.STARLARK_SEMANTICS.set(
differencer,
StarlarkSemantics.builder().setBool(BuildLanguageOptions.ENABLE_BZLMOD, true).build());
+ RegistryFunction.MODULE_MIRRORS.set(differencer, ImmutableSet.of());
ModuleFileFunction.IGNORE_DEV_DEPS.set(differencer, false);
ModuleFileFunction.INJECTED_REPOSITORIES.set(differencer, ImmutableMap.of());
ModuleFileFunction.MODULE_OVERRIDES.set(differencer, ImmutableMap.of());
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java
index 8bf26610cf..175e0a8cd1 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java
@@ -154,6 +154,7 @@ public final class BzlmodRepoRuleFunctionTest extends FoundationTestCase {
PrecomputedValue.STARLARK_SEMANTICS.set(differencer, StarlarkSemantics.DEFAULT);
ModuleFileFunction.REGISTRIES.set(differencer, ImmutableSet.of());
+ RegistryFunction.MODULE_MIRRORS.set(differencer, ImmutableSet.of());
ModuleFileFunction.IGNORE_DEV_DEPS.set(differencer, false);
ModuleFileFunction.INJECTED_REPOSITORIES.set(differencer, ImmutableMap.of());
ModuleFileFunction.MODULE_OVERRIDES.set(differencer, ImmutableMap.of());
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/DiscoveryTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/DiscoveryTest.java
index 439cee5530..9c595d8b13 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/DiscoveryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/DiscoveryTest.java
@@ -230,6 +230,7 @@ public class DiscoveryTest extends FoundationTestCase {
differencer, Optional.empty());
RepositoryDelegatorFunction.DISABLE_NATIVE_REPO_RULES.set(differencer, true);
PrecomputedValue.REPO_ENV.set(differencer, ImmutableMap.of());
+ RegistryFunction.MODULE_MIRRORS.set(differencer, ImmutableSet.of());
ModuleFileFunction.IGNORE_DEV_DEPS.set(differencer, false);
ModuleFileFunction.INJECTED_REPOSITORIES.set(differencer, ImmutableMap.of());
ModuleFileFunction.MODULE_OVERRIDES.set(differencer, ImmutableMap.of());
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
index a5fbc11f62..7ddb510d50 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
@@ -286,6 +286,7 @@ public class ModuleExtensionResolutionTest extends FoundationTestCase {
ModuleFileFunction.MODULE_OVERRIDES.set(differencer, ImmutableMap.of());
YankedVersionsUtil.ALLOWED_YANKED_VERSIONS.set(differencer, ImmutableList.of());
ModuleFileFunction.REGISTRIES.set(differencer, ImmutableSet.of(registry.getUrl()));
+ RegistryFunction.MODULE_MIRRORS.set(differencer, ImmutableSet.of());
BazelModuleResolutionFunction.CHECK_DIRECT_DEPENDENCIES.set(
differencer, CheckDirectDepsMode.WARNING);
BazelModuleResolutionFunction.BAZEL_COMPATIBILITY_MODE.set(
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java
index e1a45ab58c..3eb5b1cb5d 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java
@@ -210,6 +210,7 @@ public class ModuleFileFunctionTest extends FoundationTestCase {
RepositoryDelegatorFunction.RESOLVED_FILE_INSTEAD_OF_WORKSPACE.set(
differencer, Optional.empty());
RepositoryDelegatorFunction.DISABLE_NATIVE_REPO_RULES.set(differencer, true);
+ RegistryFunction.MODULE_MIRRORS.set(differencer, ImmutableSet.of());
PrecomputedValue.REPO_ENV.set(differencer, ImmutableMap.of());
ModuleFileFunction.IGNORE_DEV_DEPS.set(differencer, false);
ModuleFileFunction.INJECTED_REPOSITORIES.set(differencer, ImmutableMap.of());
diff --git a/src/test/java/com/google/devtools/build/lib/query2/testutil/SkyframeQueryHelper.java b/src/test/java/com/google/devtools/build/lib/query2/testutil/SkyframeQueryHelper.java
index 73e08a107d..dd662b96a3 100644
--- a/src/test/java/com/google/devtools/build/lib/query2/testutil/SkyframeQueryHelper.java
+++ b/src/test/java/com/google/devtools/build/lib/query2/testutil/SkyframeQueryHelper.java
@@ -30,6 +30,7 @@ import com.google.devtools.build.lib.bazel.bzlmod.BazelModuleResolutionFunction;
import com.google.devtools.build.lib.bazel.bzlmod.FakeRegistry;
import com.google.devtools.build.lib.bazel.bzlmod.ModuleFileFunction;
import com.google.devtools.build.lib.bazel.bzlmod.ModuleKey;
+import com.google.devtools.build.lib.bazel.bzlmod.RegistryFunction;
import com.google.devtools.build.lib.bazel.bzlmod.YankedVersionsUtil;
import com.google.devtools.build.lib.bazel.repository.RepositoryOptions.BazelCompatibilityMode;
import com.google.devtools.build.lib.bazel.repository.RepositoryOptions.CheckDirectDepsMode;
@@ -404,6 +405,7 @@ public abstract class SkyframeQueryHelper extends AbstractQueryHelper<Target> {
ModuleFileFunction.MODULE_OVERRIDES, ImmutableMap.of()),
PrecomputedValue.injected(
ModuleFileFunction.REGISTRIES, ImmutableSet.of(registry.getUrl())),
+ PrecomputedValue.injected(RegistryFunction.MODULE_MIRRORS, ImmutableSet.of()),
PrecomputedValue.injected(ModuleFileFunction.IGNORE_DEV_DEPS, false),
PrecomputedValue.injected(
ModuleFileFunction.INJECTED_REPOSITORIES, ImmutableMap.of()),
@@ -443,6 +445,7 @@ public abstract class SkyframeQueryHelper extends AbstractQueryHelper<Target> {
RepositoryDelegatorFunction.VENDOR_DIRECTORY, Optional.empty()),
PrecomputedValue.injected(
ModuleFileFunction.REGISTRIES, ImmutableSet.of(registry.getUrl())),
+ PrecomputedValue.injected(RegistryFunction.MODULE_MIRRORS, ImmutableSet.of()),
PrecomputedValue.injected(ModuleFileFunction.IGNORE_DEV_DEPS, false),
PrecomputedValue.injected(ModuleFileFunction.INJECTED_REPOSITORIES, ImmutableMap.of()),
PrecomputedValue.injected(RepositoryDelegatorFunction.DISABLE_NATIVE_REPO_RULES, false), |
Member
@fmeum Done |
Member
|
@fmeum The tests are still failing :( |
Collaborator
|
@iancha1992 One more patch: |
meteorcloudy
approved these changes
Aug 29, 2025
Merged
via the queue into
bazelbuild:release-8.4.0
with commit Aug 29, 2025
ba9a0fa
46 checks passed
dd-mergequeue bot
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Nov 25, 2025
### Motivation See: - https://github.com/bazelbuild/bazel/releases/tag/8.4.0 - https://github.com/bazelbuild/bazel/releases/tag/8.4.1 - https://github.com/bazelbuild/bazel/releases/tag/8.4.2 (8.5.0 is due soon) #### Cache & reliability - 8.4.0 honors XDG_CACHE_HOME on macOS, which will definitely help ([ABLD-300](https://datadoghq.atlassian.net/browse/ABLD-300)): bazelbuild/bazel#26773 - 8.4.1 fixes a race condition affecting repository contents cache: bazelbuild/bazel#26950 - 8.4.0 fixes another race condition affecting workers: bazelbuild/bazel#26475 #### Modules - 8.4.0 brings new `--module_mirrors` flag for fallback URLs when primary sources are slow/unavailable: bazelbuild/bazel#26850 - 8.4.0 avoids the need for dummy `MODULE.bazel` files with `git_repository`/`http_archive`: bazelbuild/bazel#26462 - 8.4.2 fixes a maintenance annoyance for `MODULE.bazel.lock` file: bazelbuild/bazel#27111 #### Platforms - 8.4.0 allows to mitigate the long path issue with **MSVC on Windows**: bazelbuild/bazel#26532 - 8.4.2 fixes **macOS** compatibility issues: bazelbuild/bazel#27014 [ABLD-300]: https://datadoghq.atlassian.net/browse/ABLD-300?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: regis.desgroppes <[email protected]>
chouquette
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Nov 27, 2025
### Motivation See: - https://github.com/bazelbuild/bazel/releases/tag/8.4.0 - https://github.com/bazelbuild/bazel/releases/tag/8.4.1 - https://github.com/bazelbuild/bazel/releases/tag/8.4.2 (8.5.0 is due soon) #### Cache & reliability - 8.4.0 honors XDG_CACHE_HOME on macOS, which will definitely help ([ABLD-300](https://datadoghq.atlassian.net/browse/ABLD-300)): bazelbuild/bazel#26773 - 8.4.1 fixes a race condition affecting repository contents cache: bazelbuild/bazel#26950 - 8.4.0 fixes another race condition affecting workers: bazelbuild/bazel#26475 #### Modules - 8.4.0 brings new `--module_mirrors` flag for fallback URLs when primary sources are slow/unavailable: bazelbuild/bazel#26850 - 8.4.0 avoids the need for dummy `MODULE.bazel` files with `git_repository`/`http_archive`: bazelbuild/bazel#26462 - 8.4.2 fixes a maintenance annoyance for `MODULE.bazel.lock` file: bazelbuild/bazel#27111 #### Platforms - 8.4.0 allows to mitigate the long path issue with **MSVC on Windows**: bazelbuild/bazel#26532 - 8.4.2 fixes **macOS** compatibility issues: bazelbuild/bazel#27014 [ABLD-300]: https://datadoghq.atlassian.net/browse/ABLD-300?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: regis.desgroppes <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
team-Configurability
platforms, toolchains, cquery, select(), config transitions
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
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 new flag allows users to specify additional mirrors for Bazel registry source URLs, taking precedence over those specified by registries. This provides a way to add mirrors without changing
bazel_registry.json, the hash of which is stored in lockfiles.RELNOTES: The new
--module_mirrorsflag accepts a comma-separated list of mirrors to use for source URLs provided by modules obtained from Bazel registries.Closes #26832.
PiperOrigin-RevId: 800384242
Change-Id: I3b56eb5fe0405f460568d7563b2ad93f6b7461a5
Commit c3889fc