Skip to content

Commit 36b3473

Browse files
authored
Merge pull request #88 from infosiftr/docker-push-on-index
Fix fetchRegistryImageIds (which is only used for "docker push" no-op) to no longer return members of an index/manifest list
2 parents ff6b5f2 + 9a271ea commit 36b3473

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cmd/bashbrew/registry.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func fetchRegistryImageIds(image string) []string {
2828
return ids
2929
}
3030

31+
ids := []string{}
32+
if img.IsImageIndex() {
33+
ids = append(ids, digest)
34+
return ids // see note above -- this function is used for "docker push" which does not and cannot (currently) support a manifest list / image index
35+
}
36+
3137
manifests, err := img.Manifests(ctx)
3238
if err != nil {
3339
if debugFlag {
@@ -36,10 +42,8 @@ func fetchRegistryImageIds(image string) []string {
3642
return nil
3743
}
3844

39-
ids := []string{}
40-
if img.IsImageIndex() {
41-
ids = append(ids, digest)
42-
}
45+
// TODO balk if manifests has more than one entry in it
46+
4347
for _, manifestDesc := range manifests {
4448
ids = append(ids, manifestDesc.Digest.String())
4549
manifest, err := img.At(manifestDesc).Manifest(ctx)

0 commit comments

Comments
 (0)