-
Notifications
You must be signed in to change notification settings - Fork 604
[WIP] Add ability to create multiple tags in one call. #2132
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
base: main
Are you sure you want to change the base?
Conversation
Fixes google#1797 Signed-off-by: Eric Smalling <[email protected]>
pkg/crane/tag.go
Outdated
| // Tag adds tag to the remote img. | ||
| func Tag(img, tag string, opt ...Option) error { | ||
| // Tag adds one or more tags to the remote img. | ||
| func Tag(img string, tags any, opt ...Option) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an API breaking change.
If we wanted to avoid this, we could maybe have WithTags(string...) Option, but even that might be kind of annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. I'll work on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New version pushed, let me know what you think.
| // Apply each tag | ||
| for i, tag := range tagList { | ||
| dst := ref.Context().Tag(tag) | ||
| if err := remote.Tag(dst, desc, o.Remote...); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nice thing about tagging being done on only one tag is that we know exactly whether to continue or fail when tagging fails. When there are multiple tags requested and one fails, should we:
- fail right away
- try to undo the successful tags?
- keep trying to apply more tags?
I don't have a super strong opinion, and failing right away like this is probably fine, but with single-tagging it's up to the caller what to do. I guess it's still up to them, and they could just keep using single-tagging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's what I was thinking about here
Signed-off-by: Eric Smalling <[email protected]>
Fixes #1797