Merge pull request #11348 from ywk253100/200330_tag_filter

Make sure the tag filter have the same behavior for empty value and *
This commit is contained in:
Wenkai Yin(尹文开) 2020-03-30 14:02:37 +08:00 committed by GitHub
commit 6815e8dc4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)