2020)
2121
2222var (
23- auth string
24- newTag string
23+ auth string
24+ newTags [] string
2525)
2626
2727func parseImageDesc (desc string ) (repo , tag , registry string , err error ) {
@@ -52,8 +52,8 @@ func main() {
5252 os .Exit (1 )
5353 }
5454
55- if strings .Contains (tag , ":" ) {
56- log .Error (ctx , "Tag cannot be a digest" , nil )
55+ if strings .Contains (tag , ":" ) && len ( newTags ) == 0 {
56+ log .Error (ctx , "Tag cannot be a digest without --new-tag " , nil )
5757 os .Exit (1 )
5858 }
5959
@@ -62,21 +62,21 @@ func main() {
6262 os .Exit (1 )
6363 }
6464
65- if newTag == "" {
66- newTag = tag
65+ if len ( newTags ) == 0 {
66+ newTags = append ( newTags , tag )
6767 }
6868
69- log .Info (ctx , fmt .Sprintf ("Indexing %s:%s and pushing with tag %s to %s" , repo , tag , newTag , registry ))
69+ log .Info (ctx , fmt .Sprintf ("Indexing %s:%s and pushing with tags %s to %s" , repo , tag , newTags , registry ))
7070
71- _ , err = indexAndPush (ctx , repo , tag , newTag , registry , auth )
71+ _ , err = indexAndPush (ctx , repo , tag , newTags , registry , auth )
7272 if err != nil {
7373 os .Exit (1 )
7474 }
7575 },
7676 }
7777
7878 rootCmd .Flags ().StringVarP (& auth , "auth" , "a" , "" , "Registry authentication token (usually USER:PASSWORD)" )
79- rootCmd .Flags ().StringVarP ( & newTag , "new-tag" , "t" , "" , "Push indexed image with this tag" )
79+ rootCmd .Flags ().StringArrayVarP ( & newTags , "new-tag" , "t" , nil , "Push indexed image with this tag" )
8080
8181 if err := rootCmd .Execute (); err != nil {
8282 _ , _ = fmt .Fprintln (os .Stderr , err )
0 commit comments