You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rootCmd.PersistentFlags().StringP("cluster", "c", "", "name of cluster (required)")
50
50
rootCmd.PersistentFlags().StringP("profile", "p", "", "name of AWS profile to use, which is set in ~/.aws/config")
51
-
rootCmd.PersistentFlags().StringP("image_tag", "", "", "Overrides the docker image tag")
51
+
rootCmd.PersistentFlags().StringP("image_tag", "", "", "Overrides the docker image tag in all container definitions. Overrides \"--image-tags\" flag.")
52
+
rootCmd.PersistentFlags().StringSliceP("image_tags", "", []string{}, "Modifies the docker image tags in container definitions. Can be specified several times, one for each container definition. Also takes comma-separated values in one tag. I.e. if there are 2 containers and --image-tags is set once to \"new\", then the image tag of the first container will be modified, leaving the second one untouched. Gets overridden by \"--image-tag\". If you have 3 container definitions and want to modify tags for the 1st and the 3rd, but leave the 2nd unchanged, specify it as \"--image_tags first_tag,,last_tag\".")
iflen(imageWithTag) ==2 { // successfully split into 2 parts: repo and tag
104
+
varnewTagstring// if set we'll change the definition
105
+
ifimageTag!="" {
106
+
newTag=imageTag// this takes precedence
107
+
} elseiflen(imageTags) >n&&imageTags[n] !="" { // the expression below will make this obsolete, as if the tag is "", then it won't be used anyway. But just adding this condition here to be explicit, just in case we want to do something in here later.
108
+
newTag=imageTags[n]
109
+
}
110
+
111
+
ifnewTag!="" {
112
+
image:=strings.Join([]string{
113
+
imageWithTag[0],
114
+
newTag,
115
+
}, ":")
116
+
containerDefinitions[n].Image=aws.String(image)
117
+
ctx.WithFields(log.Fields{
118
+
"image": image,
119
+
"new_tag": newTag,
120
+
"old_tag": imageWithTag[1],
121
+
}).Debug("Image tag changed")
122
+
}
123
+
124
+
} else {
125
+
ctx.Debug("Container doesn't seem to have a tag in the image. It's safer to not do anything.")
0 commit comments