fix redefined flags

This commit is contained in:
Robert Kaussow 2021-01-11 22:38:17 +01:00
parent 2496502ff6
commit 41a9f02b92
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
2 changed files with 7 additions and 19 deletions

View File

@ -20,19 +20,6 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
EnvVars: []string{"DRONE_REMOTE_URL"},
Destination: &settings.Build.Remote,
},
&cli.StringFlag{
Name: "commit.sha",
Usage: "git commit sha",
EnvVars: []string{"DRONE_COMMIT_SHA"},
Value: "00000000",
Destination: &settings.Build.Name,
},
&cli.StringFlag{
Name: "commit.ref",
Usage: "git commit ref",
EnvVars: []string{"DRONE_COMMIT_REF"},
Destination: &settings.Build.Ref,
},
&cli.StringFlag{
Name: "daemon.mirror",
Usage: "docker daemon registry mirror",
@ -233,12 +220,6 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Value: true,
Destination: &settings.Cleanup,
},
&cli.StringFlag{
Name: "repo.branch",
Usage: "repository default branch",
EnvVars: []string{"DRONE_REPO_BRANCH"},
Destination: &settings.Build.Branch,
},
&cli.BoolFlag{
Name: "no-cache",
Usage: "do not use cached intermediate containers",

View File

@ -74,6 +74,13 @@ type Settings struct {
// Validate handles the settings validation of the plugin.
func (p *Plugin) Validate() error {
p.settings.Build.Name = "00000000"
if p.pipeline.Commit.SHA != "" {
p.settings.Build.Name = p.pipeline.Commit.SHA
}
p.settings.Build.Branch = p.pipeline.Repo.Branch
p.settings.Build.Ref = p.pipeline.Commit.Ref
p.settings.Daemon.Registry = p.settings.Login.Registry
if p.settings.Build.TagsAuto {