Skip to content

Commit

Permalink
Merge pull request #88 from infosiftr/docker-push-on-index
Browse files Browse the repository at this point in the history
Fix fetchRegistryImageIds (which is only used for "docker push" no-op) to no longer return members of an index/manifest list
  • Loading branch information
tianon authored Dec 1, 2023
2 parents ff6b5f2 + 9a271ea commit 36b3473
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/bashbrew/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ func fetchRegistryImageIds(image string) []string {
return ids
}

ids := []string{}
if img.IsImageIndex() {
ids = append(ids, digest)
return ids // see note above -- this function is used for "docker push" which does not and cannot (currently) support a manifest list / image index
}

manifests, err := img.Manifests(ctx)
if err != nil {
if debugFlag {
Expand All @@ -36,10 +42,8 @@ func fetchRegistryImageIds(image string) []string {
return nil
}

ids := []string{}
if img.IsImageIndex() {
ids = append(ids, digest)
}
// TODO balk if manifests has more than one entry in it

for _, manifestDesc := range manifests {
ids = append(ids, manifestDesc.Digest.String())
manifest, err := img.At(manifestDesc).Manifest(ctx)
Expand Down

0 comments on commit 36b3473

Please sign in to comment.