summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorAditya Rajan <arajan@redhat.com>2021-11-01 17:15:55 +0530
committerAditya Rajan <arajan@redhat.com>2021-11-01 17:15:59 +0530
commit5c2d17e1c1c64b7e3ed1f9c82bf894cacf886d7c (patch)
tree21d8d2deed981b87f8a01293d0c5549b1df39bfe /pkg
parent09aade7816e096550e805869f1300d7198aa8f91 (diff)
downloadpodman-5c2d17e1c1c64b7e3ed1f9c82bf894cacf886d7c.tar.gz
podman-5c2d17e1c1c64b7e3ed1f9c82bf894cacf886d7c.tar.bz2
podman-5c2d17e1c1c64b7e3ed1f9c82bf894cacf886d7c.zip
[backport] tag: Support tagging manifest list instead of resolving to images
Following commit makes sure when buildah tag is invoked on a manifest list, it tags the same manifest list instead of resolving to an image and tagging it. Backporting https://github.com/containers/podman/pull/12057 Signed-off-by: Aditya Rajan <arajan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images_tag.go5
-rw-r--r--pkg/domain/infra/abi/images.go4
2 files changed, 7 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/images_tag.go b/pkg/api/handlers/compat/images_tag.go
index 7858298be..5d413a821 100644
--- a/pkg/api/handlers/compat/images_tag.go
+++ b/pkg/api/handlers/compat/images_tag.go
@@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
+ "github.com/containers/common/libimage"
"github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/pkg/api/handlers/utils"
api "github.com/containers/podman/v3/pkg/api/types"
@@ -16,7 +17,9 @@ func TagImage(w http.ResponseWriter, r *http.Request) {
// /v1.xx/images/(name)/tag
name := utils.GetName(r)
- newImage, _, err := runtime.LibimageRuntime().LookupImage(name, nil)
+ // Allow tagging manifest list instead of resolving instances from manifest
+ lookupOptions := &libimage.LookupImageOptions{ManifestList: true}
+ newImage, _, err := runtime.LibimageRuntime().LookupImage(name, lookupOptions)
if err != nil {
utils.ImageNotFound(w, name, errors.Wrapf(err, "failed to find image %s", name))
return
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index aac9a2507..df41f4f7e 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -321,7 +321,9 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
}
func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, options entities.ImageTagOptions) error {
- image, _, err := ir.Libpod.LibimageRuntime().LookupImage(nameOrID, nil)
+ // Allow tagging manifest list instead of resolving instances from manifest
+ lookupOptions := &libimage.LookupImageOptions{ManifestList: true}
+ image, _, err := ir.Libpod.LibimageRuntime().LookupImage(nameOrID, lookupOptions)
if err != nil {
return err
}