Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relocating bundle to Google Artifact Registry using --repo-based-tags fails #582

Closed
hoegaarden opened this issue Sep 27, 2023 · 1 comment · Fixed by #584
Closed

Relocating bundle to Google Artifact Registry using --repo-based-tags fails #582

hoegaarden opened this issue Sep 27, 2023 · 1 comment · Fixed by #584
Assignees
Labels
bug This issue describes a defect or unexpected behavior carvel accepted This issue should be considered for future work and that the triage process has been completed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.

Comments

@hoegaarden
Copy link

hoegaarden commented Sep 27, 2023

What steps did you take:

imgpkg copy -b "${SRC_REPO}:${TAG}" --to-repo "${DEST_REPO}" --repo-based-tags

where

  • SRC_REPO is hosted on harbor registry (at least I think so) and is a bundle referencing multiple other bundles & images
  • TAG is a specific tag, like 1.7.0-build.75

What happened:

The relocation failed on the very same artifact, consistently, when using --repo-based-tags. After further testing we've found that relocating the bundle generally works, only when using the --repo-based-tags flag we see this issue.

It seems like the problem is the leading . for .dev-pkg-apiextensions-storageversion-cmd-migrate-sha256-752dc730211b9daabec7b9e978e4cc22fd217bf49a8896e67fd73e01a4ba2c9e.imgpkg.

I am not sure if this is a problem with:

  • imgpkg
  • the bundle / its nested artifacts
  • Google Artifact Registry
copy | exporting 223 images...
copy | will export src.reg.tld/some-bits/some-packages@sha256:0021f975f73edd250cf55ca3718ec2f29128676b0119c7762d92f3d2c7f37182
   [...]
copy | will export src.reg.tld/some-bits/some-packages@sha256:fee6af3b607e98e30b9432d971163fa7b69cc0a843a70b413d81cf0e91cbe795
copy | exported 223 images
copy | importing 223 images...

copy |
copy | done uploading images
copy | Error: Error uploading images: HEAD https://us-docker.pkg.dev/v2/my-project/some-bits/some-packages/manifests/.dev-pkg-apiextensions-storageversion-cmd-migrate-sha256-752dc730211b9daabec7b9e978e4cc22fd217bf49a8896e67fd73e01a4ba2c9e.imgpkg: unexpected status code 400 Bad Request (HEAD responses have no body, use GET for details)

imgpkg: Error: HEAD https://us-docker.pkg.dev/v2/my-project/some-bits/some-packages/manifests/.dev-pkg-apiextensions-storageversion-cmd-migrate-sha256-752dc730211b9daabec7b9e978e4cc22fd217bf49a8896e67fd73e01a4ba2c9e.imgpkg: unexpected status code 400 Bad Request (HEAD responses have no body, use GET for details)

Running with --debug showed some more info:

   [...]

2023/09/26 18:19:06 --> HEAD https://us-docker.pkg.dev/v2/my-project/some-bits/some-packages/manifests/.dev-pkg-apiextensions-storageversion-cmd-migrate-sha256-752dc730211b9daabec7b9e978e4cc22fd217bf49a8896e67fd73e01a4ba2c9e.imgpkg
2023/09/26 18:19:06 HEAD /v2/my-project/some-bits/some-packages/manifests/.dev-pkg-apiextensions-storageversion-cmd-migrate-sha256-752dc730211b9daabec7b9e978e4cc22fd217bf49a8896e67fd73e01a4ba2c9e.imgpkg HTTP/1.1
Host: us-docker.pkg.dev
User-Agent: go-containerregistry/v0.16.1
Accept: application/vnd.docker.distribution.manifest.v1+json,application/vnd.docker.distribution.manifest.v1+prettyjws,application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.index.v1+json
Authorization: <redacted>


2023/09/26 18:19:07 <-- 400 https://us-docker.pkg.dev/v2/my-project/some-bits/some-packages/manifests/.dev-pkg-apiextensions-storageversion-cmd-migrate-sha256-752dc730211b9daabec7b9e978e4cc22fd217bf49a8896e67fd73e01a4ba2c9e.imgpkg (41.601806ms)
2023/09/26 18:19:07 HTTP/1.1 400 Bad Request
Content-Length: 207
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Content-Type: application/json; charset=utf-8
Date: Tue, 26 Sep 2023 16:19:06 GMT
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0
   [...]

What did you expect:

The bundle to be relocated, including all its referenced artifacts.

Anything else you would like to add:

  • Relocating the bundle without --repo-based-tags works
  • The same behaviour shows when I relocate to europe-docker.pkg.dev/... and us-docker.pkg.dev/...
  • I also tried to imgpkg copy slightly different, but all showed the very same error
    • pull everything down into a tarball (--to-tar) and upload from that (--tar & --to-repo)
    • use different --concurrency, down to 1
  • Relocating other versions of this bundle (same source registry) into the very same destination registry work fine
    • on a first glance, for those succeeding bundles, I don't see any artifacts with a leading . tho

Environment:

  • imgpkg version (use imgpkg --version): 0.38.0
  • Docker registry used (e.g. Docker HUB): Google Artifact Registry
  • OS (e.g. from /etc/os-release): Linux 6.2.0 / Ubuntu

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@hoegaarden hoegaarden added bug This issue describes a defect or unexpected behavior carvel triage This issue has not yet been reviewed for validity labels Sep 27, 2023
@hoegaarden hoegaarden changed the title Relocating bundle to Google Artifact Registry fails Relocating bundle to Google Artifact Registry using --repo-based-tags fails Sep 27, 2023
@joaopapereira
Copy link
Member

Sounds like there is an issue in the function https://github.com/carvel-dev/imgpkg/blob/develop/pkg/imgpkg/internal/util/tag.go#L59C41-L59C41
We need to make sure that . is not the first letter of the tag and it should follow the regex [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}

@joaopapereira joaopapereira added carvel accepted This issue should be considered for future work and that the triage process has been completed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed carvel triage This issue has not yet been reviewed for validity labels Sep 28, 2023
@rcmadhankumar rcmadhankumar self-assigned this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel accepted This issue should be considered for future work and that the triage process has been completed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants