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

push just a manifest to a remote #862

Closed
deitch opened this issue Dec 8, 2020 · 9 comments · Fixed by #863
Closed

push just a manifest to a remote #862

deitch opened this issue Dec 8, 2020 · 9 comments · Fixed by #863

Comments

@deitch
Copy link
Collaborator

deitch commented Dec 8, 2020

Is there a way to push just a manifest to a remote? I can write a layer. I also can write a whole image or index, which (by looking at the code, appear to) actually write the individual layers.

The simplest use case is if I have a manifest that points to blobs that already are in the remote registry. I don't want to pull and push the whole image, just to create either a new (slightly different) manifest (image/index) for the root with a different tag, or even the identical manifest (image/index) with a different tag.

@jonjohnsonjr
Copy link
Collaborator

I believe remote.Tag does what you want. I've updated the godoc in the linked PR to (hopefully) make this clearer.

@deitch
Copy link
Collaborator Author

deitch commented Dec 8, 2020

Hmm. Is there a practical example?

@jonjohnsonjr
Copy link
Collaborator

We use this to implement crane tag: https://github.com/google/go-containerregistry/blob/master/pkg/crane/tag.go

If you're interested in something like this that just pushes by digest, it doesn't exist, but it seems like you are okay with just tag?

@jonjohnsonjr
Copy link
Collaborator

Arguably, this should have been named remote.WriteTag so that it's more easily recognizable as a write method, but at the time I was thinking of the verb form of tag. I have very mild regrets about this, but I think it's fine.

@deitch
Copy link
Collaborator Author

deitch commented Dec 8, 2020

Oh excellent. Thank you. Closing this out.

@deitch deitch closed this as completed Dec 8, 2020
@deitch
Copy link
Collaborator Author

deitch commented Dec 8, 2020

I was sure there was a bug, because it kept erroring, but I realized that it was defaulting to anonymous auth. Is there some painfully obvious way from here that I am just missing for authenticating using your default docker credentials, whatever they are?

@jonjohnsonjr
Copy link
Collaborator

The magic incantation you want is remote.WithAuthFromKeychain(authn.DefaultKeychain).

The name is too long, and I'd like to add remote.WithKeychain to make it a bit easier to type.

@deitch
Copy link
Collaborator Author

deitch commented Dec 8, 2020

Magic indeed.

@jonjohnsonjr
Copy link
Collaborator

This is documented here but let me know what we can improve to make this more discoverable.

My thinking was that by default, we don't want to read and transmit credentials over the internet, even if that's what you usually want to do. Making this explicit requires you to wire this up yourself and shifts some of that custody responsibility onto the library consumer. I think it would be even more magic if it just worked by default :P

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 a pull request may close this issue.

2 participants