Be able to force docker to update the tags
This commit is contained in:
parent
2f76696226
commit
a6caa67c6f
1 changed files with 6 additions and 1 deletions
|
@ -33,6 +33,7 @@ type Docker struct {
|
||||||
KeepBuild bool `yaml:"keep_build"`
|
KeepBuild bool `yaml:"keep_build"`
|
||||||
Tag string `yaml:"tag"`
|
Tag string `yaml:"tag"`
|
||||||
Tags []string `yaml:"tags"`
|
Tags []string `yaml:"tags"`
|
||||||
|
ForceTags bool `yaml:"force_tags"`
|
||||||
|
|
||||||
Condition *condition.Condition `yaml:"when,omitempty"`
|
Condition *condition.Condition `yaml:"when,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,11 @@ func (d *Docker) Write(f *buildfile.Buildfile) {
|
||||||
// Tag and push all tags
|
// Tag and push all tags
|
||||||
for _, tag := range d.Tags {
|
for _, tag := range d.Tags {
|
||||||
if tag != buildImageTag {
|
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))
|
f.WriteCmd(fmt.Sprintf("docker push %s:%s", d.ImageName, tag))
|
||||||
|
|
Loading…
Reference in a new issue