From 1b327e9d4eb0754b36a3a891cb1a69accd055afd Mon Sep 17 00:00:00 2001
From: Stefan Prodan <stefan.prodan@gmail.com>
Date: Mon, 11 Jul 2022 18:15:35 +0300
Subject: [PATCH] Show artifact digest in list output

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
---
 internal/oci/list.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/internal/oci/list.go b/internal/oci/list.go
index e827c472..9901d1d8 100644
--- a/internal/oci/list.go
+++ b/internal/oci/list.go
@@ -57,12 +57,17 @@ func List(ctx context.Context, url string) ([]Metadata, error) {
 			return nil, fmt.Errorf("parsing manifest failed: %w", err)
 		}
 
-		meta.Digest = manifest.Config.Digest.String()
 		if m, err := MetadataFromAnnotations(manifest.Annotations); err == nil {
 			meta.Revision = m.Revision
 			meta.Source = m.Source
 		}
 
+		digest, err := crane.Digest(meta.URL, craneOptions(ctx)...)
+		if err != nil {
+			return nil, fmt.Errorf("fetching digest failed: %w", err)
+		}
+		meta.Digest = digest
+
 		metas = append(metas, meta)
 	}
 
-- 
GitLab