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

oci_push with remote_tags does not work with insecure repositories #527

Closed
DrThomasRock opened this issue Mar 14, 2024 · 2 comments · Fixed by #709
Closed

oci_push with remote_tags does not work with insecure repositories #527

DrThomasRock opened this issue Mar 14, 2024 · 2 comments · Fixed by #709
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@DrThomasRock
Copy link

When migrating from container_push to oci_push with a repository that fails to be detected as insecure, it appears the alternative for insecure_repository is to specify args = ["--insecure"] (taken from this website). This works like a charm if you're simply pushing, but if you combine this with the remote_tags attribute, the request to add tags will fail.

Example Bazel target

oci_push(
    name = "engine.push",
    args = ["--insecure"],
    image = ":engine",
    remote_tags = ":version_tag",
    repository = "k3d-registry.localhost:9999/engine",
)

will fail with the following exception

Error: fetching "k3d-registry.localhost:9999/engine@sha256:774d75357a396d3659774d71754130646e517874444a4b6d7355376d68723065": Get "https://k3d-registry.localhost:9999/v2/": http: server gave HTTP response to HTTPS client

This is due to args being passed to the push command but not the subsequent tags commands.

If I patch push.sh.tpl to pass ARGS into the tags command as well, then the bazel target above works as expected. I'm wondering if this is the proper solution, or if there's a reason ARGS shouldn't be passed to the tags command. If that is the case, is there an alternative to tagging with an insecure repository?

@thesayyn thesayyn added the bug Something isn't working label Mar 22, 2024
@thesayyn
Copy link
Collaborator

thesayyn commented Mar 22, 2024

This is an oversight, and indeed a bug. We should pass --insecure, or all global flags down to every crane invocation.

@thesayyn thesayyn added this to the 2.0 milestone May 8, 2024
@thesayyn thesayyn removed this from the 2.0 milestone May 30, 2024
@thesayyn thesayyn changed the title oci_push with remove_tags does not work with insecure repositories oci_push with remote_tags does not work with insecure repositories May 30, 2024
@thesayyn thesayyn added this to the 2.0 milestone May 30, 2024
@alexeagle alexeagle added the help wanted Extra attention is needed label Sep 6, 2024
@alexeagle alexeagle removed this from the 2.0 milestone Sep 6, 2024
@ahans
Copy link
Contributor

ahans commented Oct 4, 2024

This is an oversight, and indeed a bug. We should pass --insecure, or all global flags down to every crane invocation.

Not sure if I'm missing anything, but what @DrThomasRock writes in the last paragraph sounds like all there is to be done for this? Anyway, I created a a PR with what I think is a fix. Let's discuss over there if more needs to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants