diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-07-27 16:54:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 16:54:55 -0400 |
commit | b933b8a1c1f5de82fb201f340a5de82f49d2a0bb (patch) | |
tree | 0915ee9313ab22e9598b949e225cccf08be82bda /pkg | |
parent | f7a0a24d200325717ae924755365d28cf5ee5b0d (diff) | |
parent | 8628c01f5e085335afc5ef3b4a019d09d2147858 (diff) | |
download | podman-b933b8a1c1f5de82fb201f340a5de82f49d2a0bb.tar.gz podman-b933b8a1c1f5de82fb201f340a5de82f49d2a0bb.tar.bz2 podman-b933b8a1c1f5de82fb201f340a5de82f49d2a0bb.zip |
Merge pull request #15034 from sstosh/manifest-push-rm
Fix: manifest push --rm removes a correct manifest list
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 3 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/manifest.go | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index d20744d76..bdc3d9513 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -331,7 +331,8 @@ func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination strin } if opts.Rm { - if _, rmErrors := ir.Libpod.LibimageRuntime().RemoveImages(ctx, []string{manifestList.ID()}, nil); len(rmErrors) > 0 { + rmOpts := &libimage.RemoveImagesOptions{LookupManifest: true} + if _, rmErrors := ir.Libpod.LibimageRuntime().RemoveImages(ctx, []string{manifestList.ID()}, rmOpts); len(rmErrors) > 0 { return "", fmt.Errorf("error removing manifest after push: %w", rmErrors[0]) } } diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go index d2554f198..4a3148fac 100644 --- a/pkg/domain/infra/tunnel/manifest.go +++ b/pkg/domain/infra/tunnel/manifest.go @@ -110,5 +110,15 @@ func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination strin } } digest, err := manifests.Push(ir.ClientCtx, name, destination, options) + if err != nil { + return "", fmt.Errorf("error adding to manifest list %s: %w", name, err) + } + + if opts.Rm { + if _, rmErrors := ir.Remove(ctx, []string{name}, entities.ImageRemoveOptions{LookupManifest: true}); len(rmErrors) > 0 { + return "", fmt.Errorf("error removing manifest after push: %w", rmErrors[0]) + } + } + return digest, err } |