summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-12-01 13:19:04 -0500
committerValentin Rothberg <rothberg@redhat.com>2021-12-02 15:34:03 +0100
commit8d6d9df40787be0292289bb9b81b10560459d794 (patch)
tree0a98fe51ce5c061fdf9189ecccab2fb87e18442b /pkg/api
parent078e633294b07027c9f531ac1e849bb5b3d779f8 (diff)
downloadpodman-8d6d9df40787be0292289bb9b81b10560459d794.tar.gz
podman-8d6d9df40787be0292289bb9b81b10560459d794.tar.bz2
podman-8d6d9df40787be0292289bb9b81b10560459d794.zip
compat API: push: report size of manifest
We don't yet have a local registry running in the APIv2 tests. Tested manually. [NO NEW TESTS NEEDED] Fixes: https://github.com/containers/podman/issues/12468 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/compat/images_push.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go
index 5ecb429ae..3a84b5799 100644
--- a/pkg/api/handlers/compat/images_push.go
+++ b/pkg/api/handlers/compat/images_push.go
@@ -74,10 +74,16 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
return
}
imageName = possiblyNormalizedName
- if _, _, err := runtime.LibimageRuntime().LookupImage(possiblyNormalizedName, nil); err != nil {
+ localImage, _, err := runtime.LibimageRuntime().LookupImage(possiblyNormalizedName, nil)
+ if err != nil {
utils.ImageNotFound(w, imageName, errors.Wrapf(err, "failed to find image %s", imageName))
return
}
+ rawManifest, _, err := localImage.Manifest(r.Context())
+ if err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusBadRequest, err)
+ return
+ }
authconf, authfile, key, err := auth.GetCredentials(r)
if err != nil {
@@ -196,7 +202,7 @@ loop: // break out of for/select infinite loop
if tag == "" {
tag = "latest"
}
- report.Status = fmt.Sprintf("%s: digest: %s", tag, string(digestBytes))
+ report.Status = fmt.Sprintf("%s: digest: %s size: %d", tag, string(digestBytes), len(rawManifest))
if err := enc.Encode(report); err != nil {
logrus.Warnf("Failed to json encode error %q", err.Error())
}