From a6caa67c6fe967f7e2db4cdefeb99ba6d8cb6621 Mon Sep 17 00:00:00 2001 From: Alvaro Date: Fri, 30 Jan 2015 09:10:19 +0200 Subject: [PATCH] Be able to force docker to update the tags --- plugin/publish/docker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/publish/docker.go b/plugin/publish/docker.go index eda38e298..7cafb35b0 100644 --- a/plugin/publish/docker.go +++ b/plugin/publish/docker.go @@ -33,6 +33,7 @@ type Docker struct { KeepBuild bool `yaml:"keep_build"` Tag string `yaml:"tag"` Tags []string `yaml:"tags"` + ForceTags bool `yaml:"force_tags"` Condition *condition.Condition `yaml:"when,omitempty"` } @@ -100,7 +101,11 @@ func (d *Docker) Write(f *buildfile.Buildfile) { // Tag and push all tags for _, tag := range d.Tags { if tag != buildImageTag { - f.WriteCmd(fmt.Sprintf("docker tag %s:%s %s:%s", d.ImageName, buildImageTag, d.ImageName, tag)) + var options string + if d.ForceTags { + options = "-f" + } + f.WriteCmd(fmt.Sprintf("docker tag %s %s:%s %s:%s", options, d.ImageName, buildImageTag, d.ImageName, tag)) } f.WriteCmd(fmt.Sprintf("docker push %s:%s", d.ImageName, tag))