From 9724da1ff2478d2450f671d3f5ede679b8822ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Fri, 3 Dec 2021 17:40:17 +0100 Subject: [PATCH] Remove a special case for failing to list tags in (skopeo sync) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - It's unclear why it exists in the first place - Looking at callers of imagesToCopyFromRepo, the only caller of this: either the input is a single repo, in which case the failure to list tags clearly results in a no-op and a "No images to sync" fatal failure ... - ... or the input is YAML, and in that case the caller is already skipping the repo on a failure. Either way, it's unclear why we would have a special "Registry disallows tag retrieval" error special case instead of the generic text. Signed-off-by: Miloslav Trmač --- cmd/skopeo/sync.go | 10 +--------- integration/sync_test.go | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/cmd/skopeo/sync.go b/cmd/skopeo/sync.go index 6884d8b1..2336669c 100644 --- a/cmd/skopeo/sync.go +++ b/cmd/skopeo/sync.go @@ -216,15 +216,7 @@ func getImageTags(ctx context.Context, sysCtx *types.SystemContext, repoRef refe } tags, err := docker.GetRepositoryTags(ctx, sysCtx, dockerRef) if err != nil { - var unauthorizedForCredentials docker.ErrUnauthorizedForCredentials - if errors.As(err, &unauthorizedForCredentials) { - // Some registries may decide to block the "list all tags" endpoint. - // Gracefully allow the sync to continue in this case. - logrus.Warnf("Registry disallows tag list retrieval: %s", err) - tags = nil - } else { - return nil, fmt.Errorf("Error determining repository tags for image %s: %w", name, err) - } + return nil, fmt.Errorf("Error determining repository tags for image %s: %w", name, err) } return tags, nil diff --git a/integration/sync_test.go b/integration/sync_test.go index 25c369b5..16569baf 100644 --- a/integration/sync_test.go +++ b/integration/sync_test.go @@ -534,7 +534,7 @@ func (s *SyncSuite) TestFailsNoSourceImages(c *check.C) { assertSkopeoFails(c, ".*No images to sync found in .*", "sync", "--scoped", "--dest-tls-verify=false", "--src", "dir", "--dest", "docker", tmpDir, v2DockerRegistryURL) - assertSkopeoFails(c, ".*No images to sync found in .*", + assertSkopeoFails(c, ".*Error determining repository tags for repo docker.io/library/hopefully_no_images_will_ever_be_called_like_this: fetching tags list: requested access to the resource is denied.*", "sync", "--scoped", "--dest-tls-verify=false", "--src", "docker", "--dest", "docker", "hopefully_no_images_will_ever_be_called_like_this", v2DockerRegistryURL) } @@ -557,7 +557,7 @@ func (s *SyncSuite) TestFailsWithDockerSourceUnauthorized(c *check.C) { tmpDir := c.MkDir() //untagged - assertSkopeoFails(c, ".*Registry disallows tag list retrieval.*", + assertSkopeoFails(c, ".*requested access to the resource is denied.*", "sync", "--scoped", "--src", "docker", "--dest", "dir", repo, tmpDir) //tagged