mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-11-16 09:30:41 +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",
|
||||
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
||||
Usage: "sets repository tags to use for the image",
|
||||
Value: cli.NewStringSlice([]string{"latest"}...),
|
||||
FilePath: ".tags",
|
||||
Destination: &settings.Build.Tags,
|
||||
},
|
||||
|
@ -84,7 +84,7 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
||||
}
|
||||
|
||||
args = append(args, build.Context)
|
||||
if !dryrun {
|
||||
if !dryrun && len(build.Tags.Value()) > 0 {
|
||||
args = append(args, "--push")
|
||||
}
|
||||
if build.Compress {
|
||||
|
@ -87,12 +87,12 @@ func (p *Plugin) Validate() error {
|
||||
p.settings.Build.TagsSuffix,
|
||||
)
|
||||
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
|
||||
}
|
||||
p.settings.Build.Tags = *cli.NewStringSlice(tag...)
|
||||
} 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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user