-
Notifications
You must be signed in to change notification settings - Fork 528
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
update crane mutate annotation/label args to allow commas in label values #1178
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1178 +/- ##
=======================================
Coverage 75.23% 75.23%
=======================================
Files 108 108
Lines 7855 7855
=======================================
Hits 5910 5910
Misses 1379 1379
Partials 566 566 Continue to review full report at Codecov.
|
6053095
to
61089c5
Compare
How are the client docs updated? I found the hack/presubmit.sh to validate but am not sure how to re-generate the docs for the updated client. |
./hack/update-codegen.sh Specifically the last line: https://github.com/google/go-containerregistry/blob/main/hack/update-codegen.sh#L52 |
Ahh I literally just ran that! Asked too soon :P |
61089c5
to
e562b98
Compare
cmd/crane/cmd/mutate.go
Outdated
// splitKeyVals splits key value pairs which is in form hello=world | ||
func splitKeyVals(kvPairs []string) (map[string]string, error) { | ||
// validateKeyVals ensures no values are empty | ||
func validateKeyVals(kvPairs map[string]string) (map[string]string, 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 could just return error
, and not bother creating a copy of the input kv map.
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.
All set! I like that much better - we can use "labels" and "annotations" off the bat.
…lues With the current argument type, a common in a label value (a reasonable thing to have) will be split and parsed as a separate label, and the client errors. This commit updates the flag to StringToStringVarP so we start with a map[string]string off the bat, and do not need to do special parsing beyond checking for empty strings. Signed-off-by: vsoch <vsoch@users.noreply.github.com>
e562b98
to
e89b699
Compare
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.
Thank you! 👍
Thank you! |
With the current argument type, a common in a label value (a reasonable thing to have) will be split and parsed as a separate label, and the client errors. This commit updates the flag to StringToStringVarP so we start with a map[string]string off the bat, and do not need to do special parsing beyond checking for empty strings.
I also added some additional notes to the crane mutate doc page for points that weren't clear to me - 1. that the image needed to exist in a registry and would be changed there, and 2. a full example for using the command.
This will close #1177
Signed-off-by: vsoch vsoch@users.noreply.github.com