diff --git a/cmd/history.go b/cmd/history.go index 2b7728b..13c92ea 100644 --- a/cmd/history.go +++ b/cmd/history.go @@ -81,7 +81,7 @@ func ExecuteHistoryCleanupCommand(args []string) error { } var matchingTags = cleanup.GetMatchingTags(&gitCandidates, &imageStreamTags, matchOption) - activeImageStreamTags, err := openshift.GetActiveImageStreamTags(namespace, image, imageStreamTags) + activeImageStreamTags, err := openshift.GetActiveImageStreamTags(namespace, image, matchingTags) if err != nil { return fmt.Errorf("could not retrieve active image stream tags for '%s/%s': %w", namespace, image, err) } diff --git a/pkg/openshift/imagestream.go b/pkg/openshift/imagestream.go index d68c873..f3bf9ef 100644 --- a/pkg/openshift/imagestream.go +++ b/pkg/openshift/imagestream.go @@ -24,6 +24,9 @@ var ( // GetActiveImageStreamTags retrieves the image streams tags referenced in some Kubernetes resources func GetActiveImageStreamTags(namespace, imageStream string, imageStreamTags []string) (activeImageStreamTags []string, funcError error) { + if len(imageStreamTags) == 0 { + return []string{}, nil + } funk.ForEach(resources, func(resource schema.GroupVersionResource) { funk.ForEach(imageStreamTags, func(imageStreamTag string) { if funk.ContainsString(activeImageStreamTags, imageStreamTag) {