diff --git a/plugins/registry/functions.go b/plugins/registry/functions.go index 708b71894..95cab0bb0 100644 --- a/plugins/registry/functions.go +++ b/plugins/registry/functions.go @@ -117,14 +117,18 @@ func pushToRegistry(appName string, tag int, imageID string, imageRepo string) e if !dockerTag(imageID, extraTagImage) { return errors.New(fmt.Sprintf("Unable to tag image as %s", extraTag)) } + func() { + defer func() { + common.LogVerboseQuiet(fmt.Sprintf("Untagging extra tag %s", extraTag)) + if !dockerRemoveTag(extraTagImage) { + common.LogWarn(fmt.Sprintf("Unable to untag extra tag %s", extraTag)) + } + }() + }() common.LogVerboseQuiet(fmt.Sprintf("Pushing %s", extraTagImage)) if !dockerPush(extraTagImage) { 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)) - } } }