Skip to content

Commit ba07a05

Browse files
Merge pull request #17258 from sjenning/fix-image-filter
Automatic merge from submit-queue. check RepoTags len before accessing xref https://bugzilla.redhat.com/show_bug.cgi?id=1511852 @derekwaynecarr
2 parents a589cf1 + d6337a8 commit ba07a05

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/oc/experimental/dockergc/dockergc.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,12 @@ func doGarbageCollection(ctx context.Context, client *dockerapi.Client, options
212212
return nil
213213
}
214214
// filter openshift infra images
215-
if strings.HasPrefix(i.RepoTags[0], "registry.ops.openshift.com/openshift3") ||
216-
strings.HasPrefix(i.RepoTags[0], "docker.io/openshift") {
217-
fmt.Println("skipping infra image", i.RepoTags[0])
215+
if len(i.RepoTags) > 0 {
216+
if strings.HasPrefix(i.RepoTags[0], "registry.ops.openshift.com/openshift3") ||
217+
strings.HasPrefix(i.RepoTags[0], "docker.io/openshift") {
218+
fmt.Println("skipping infra image", i.RepoTags[0])
219+
continue
220+
}
218221
}
219222
// filter young images
220223
age := time.Now().Sub(time.Unix(i.Created, 0))

0 commit comments

Comments
 (0)