mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-09-28 10:18:16 +00:00
fix: fix auto_tag behavior to avoid unexpected publishing
This commit is contained in:
parent
a3e33afdf6
commit
221c9e6a73
@ -117,7 +117,6 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
Name: "tags",
|
Name: "tags",
|
||||||
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
||||||
Usage: "sets repository tags to use for the image",
|
Usage: "sets repository tags to use for the image",
|
||||||
Value: cli.NewStringSlice([]string{"latest"}...),
|
|
||||||
FilePath: ".tags",
|
FilePath: ".tags",
|
||||||
Destination: &settings.Build.Tags,
|
Destination: &settings.Build.Tags,
|
||||||
},
|
},
|
||||||
|
@ -84,7 +84,7 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, build.Context)
|
args = append(args, build.Context)
|
||||||
if !dryrun {
|
if !dryrun && len(build.Tags.Value()) > 0 {
|
||||||
args = append(args, "--push")
|
args = append(args, "--push")
|
||||||
}
|
}
|
||||||
if build.Compress {
|
if build.Compress {
|
||||||
|
@ -87,12 +87,12 @@ func (p *Plugin) Validate() error {
|
|||||||
p.settings.Build.TagsSuffix,
|
p.settings.Build.TagsSuffix,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Printf("cannot build docker image for %s, invalid semantic version", p.settings.Build.Ref)
|
logrus.Printf("cannot generate tags from %s, invalid semantic version", p.settings.Build.Ref)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
p.settings.Build.Tags = *cli.NewStringSlice(tag...)
|
p.settings.Build.Tags = *cli.NewStringSlice(tag...)
|
||||||
} else {
|
} else {
|
||||||
logrus.Printf("skipping automated docker build for %s", p.settings.Build.Ref)
|
logrus.Printf("skip auto-tagging for %s, not on default branch or tag", p.settings.Build.Ref)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user