From ea9aa68b0fec218c2d5ba777c6c1a9015565f83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 6 Sep 2022 22:25:45 +0200 Subject: [PATCH] Reorganize the "list tags failed" logic in inspect.go a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... to allow adding more cases. Signed-off-by: Miloslav Trmač --- cmd/skopeo/inspect.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/skopeo/inspect.go b/cmd/skopeo/inspect.go index 9c364f4c..1b8adf77 100644 --- a/cmd/skopeo/inspect.go +++ b/cmd/skopeo/inspect.go @@ -205,9 +205,13 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error) if err != nil { // Some registries may decide to block the "list all tags" endpoint; // gracefully allow the inspect to continue in this case: + fatalFailure := true // - AWS ECR rejects it with 403 (Forbidden) if the "ecr:ListImages" // action is not allowed. - if !strings.Contains(err.Error(), "403") { + if strings.Contains(err.Error(), "403") { + fatalFailure = false + } + if fatalFailure { return fmt.Errorf("Error determining repository tags: %w", err) } logrus.Warnf("Registry disallows tag list retrieval; skipping")