Make sure the tag filter have the same behavior for empty value and *

Fixes #11233, make sure the tag filter have the same behavior for empty value and *

Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
Wenkai Yin 2020-03-30 10:10:12 +08:00
parent 9a205ddbc3
commit 7ec5595bd8

View File

@ -155,6 +155,19 @@ func (a *artifactTagFilter) Filter(artifacts []*model.Artifact) ([]*model.Artifa
}
var result []*model.Artifact
for _, artifact := range artifacts {
// untagged artifact
if len(artifact.Tags) == 0 {
match, err := util.Match(a.pattern, "")
if err != nil {
return nil, err
}
if match {
result = append(result, artifact)
}
continue
}
// tagged artifact
var tags []string
for _, tag := range artifact.Tags {
match, err := util.Match(a.pattern, tag)