From 9b6f5b6e75157c43608a17a020ae622cd16b689a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 6 Sep 2022 22:15:17 +0200 Subject: [PATCH] Add a workaround for public.ecr.aws not implementing tag list at all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per https://github.com/containers/skopeo/issues/1230 , and https://github.com/containers/image/blob/155d0665e80f9ba9839cd1273d9caa0f3f32bd70/docker/errors_test.go#L88 . Signed-off-by: Miloslav Trmač --- cmd/skopeo/inspect.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/skopeo/inspect.go b/cmd/skopeo/inspect.go index 01bf5082..f18a8ef2 100644 --- a/cmd/skopeo/inspect.go +++ b/cmd/skopeo/inspect.go @@ -213,6 +213,16 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error) if ok := errors.As(err, &ec); ok && ec.ErrorCode() == errcode.ErrorCodeDenied { fatalFailure = false } + // - public.ecr.aws does not implement the endpoint at all, and fails with 404: + // https://github.com/containers/skopeo/issues/1230 + // This is actually "code":"NOT_FOUND", and the parser doesn’t preserve that. + // So, also check the error text. + if ok := errors.As(err, &ec); ok && ec.ErrorCode() == errcode.ErrorCodeUnknown { + var e errcode.Error + if ok := errors.As(err, &e); ok && e.Code == errcode.ErrorCodeUnknown && e.Message == "404 page not found" { + fatalFailure = false + } + } if fatalFailure { return fmt.Errorf("Error determining repository tags: %w", err) }