Skip to content
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

Add support for registry_mirrors #780

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sluongng
Copy link

@sluongng sluongng commented Feb 24, 2025

Most of the PR was generated by Github Copilots.

@sluongng
Copy link
Author

sluongng commented Feb 24, 2025

I tested it manually with BuildBuddy repo with

--- a/WORKSPACE
+++ b/WORKSPACE
@@ -536,6 +536,7 @@ oci_pull(
     name = "busybox",
     digest = "sha256:c230832bd3b0be59a6c47ed64294f9ce71e91b327957920b6929a0caa8353140",
     image = "mirror.gcr.io/library/busybox:1.36.1",
+    registry_mirrors = ["mirror.gcr.io"],
     platforms = ["linux/amd64"],
 )

and common --override_repository=rules_oci=/Users/sluongng/work/misc/rules_oci.

Then do

> bazel clean --expunge

> bazel query @busybox//... --repository_cache=

and got this build event on the server side

{
    "id": {
        "fetch": {
            "url": "https://mirror.gcr.io/v2/library/busybox/manifests/sha256:c230832bd3b0be59a6c47ed64294f9ce71e91b327957920b6929a0caa8353140"
        }
    },
    "fetch": {
        "success": true
    }
}

@sluongng sluongng marked this pull request as draft February 24, 2025 17:39
@sluongng
Copy link
Author

hmm i missed that I double set the mirror in oci_pull... need to fix it a bit more

@apesternikov
Copy link
Member

It could be very useful to have an ability to configure all parts of the mirrored image location, not just a registry. It is a common use case to mirror external images to a private repository with additional prefix using https://github.com/fasterci/rules_gitops/tree/main/mirror. Is it possible to expose an additional images[] parameter?

@sluongng sluongng force-pushed the main branch 3 times, most recently from ffda820 to 2e65771 Compare February 25, 2025 09:12
Most of the PR was generated by Github Copilots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants