Untag extra image tag

This commit is contained in:
Krzysztof Taraszka
2024-02-25 15:23:27 +01:00
parent dff13a8f1b
commit 881d16ea90

View File

@@ -120,7 +120,11 @@ func pushToRegistry(appName string, tag int, imageID string, imageRepo string) e
}
common.LogVerboseQuiet(fmt.Sprintf("Pushing %s", extraTagImage))
if !dockerPush(extraTagImage) {
return errors.New(fmt.Sprintf("Unable to push image with %s tag", tag))
return errors.New(fmt.Sprintf("Unable to push image with %s tag", extraTag))
}
common.LogVerboseQuiet(fmt.Sprintf("Untagging extra tag %s", extraTag))
if !dockerRemoveTag(extraTagImage) {
return errors.New(fmt.Sprintf("Unable to untag extra tag %s", extraTag))
}
}
}
@@ -156,6 +160,17 @@ func dockerTag(imageID string, imageTag string) bool {
return true
}
func dockerRemoveTag(image string) bool {
cmd := sh.Command(common.DockerBin(), "image", "remove", image)
cmd.Stdout = nil
cmd.Stderr = nil
if err := cmd.Run(); err != nil {
return false
}
return true
}
func dockerPush(imageTag string) bool {
cmd := sh.Command(common.DockerBin(), "image", "push", imageTag)
cmd.Stdout = os.Stdout