ingore empty string tags

This commit is contained in:
6543 2022-09-28 03:25:04 +02:00
parent 9a1c38c979
commit 06d32b13a5
No known key found for this signature in database
GPG Key ID: C99B82E40B027BAE

View File

@ -6,6 +6,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -99,7 +100,18 @@ func (p *Plugin) Validate() error {
logrus.Printf("skipping automated docker build for %s", p.settings.Build.Ref) logrus.Printf("skipping automated docker build for %s", p.settings.Build.Ref)
return nil return nil
} }
} else {
// ignore empty tags
var tags []string
for _, t := range p.settings.Build.Tags.Value() {
t = strings.TrimSpace(t)
if t != "" {
tags = append(tags, t)
}
}
p.settings.Build.Tags = *cli.NewStringSlice(tags...)
} }
if p.settings.Build.LabelsAuto { if p.settings.Build.LabelsAuto {
p.settings.Build.Labels = *cli.NewStringSlice(p.Labels()...) p.settings.Build.Labels = *cli.NewStringSlice(p.Labels()...)
} }