Conversation
Signed-off-by: João Pereira <484633+joaodrp@users.noreply.github.com>
Signed-off-by: João Pereira <484633+joaodrp@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## main #3427 +/- ##
==========================================
+ Coverage 56.16% 56.19% +0.02%
==========================================
Files 102 102
Lines 7303 7323 +20
==========================================
+ Hits 4102 4115 +13
- Misses 2553 2556 +3
- Partials 648 652 +4
Continue to review full report at Codecov.
|
| if err := repository.Tags(ctx).Tag(ctx, tag, distribution.Descriptor{Digest: dgst}); err != nil { | ||
| t.Fatalf("unexpected error tagging manifest: %v", err) | ||
| } | ||
|
|
There was a problem hiding this comment.
The manifest was not tagged in this test, so there was no tag to delete...
| err = repository.Tags(ctx).Untag(ctx, m.Tag) | ||
| if err != nil { | ||
| t.Fatalf("unexpected error deleting tag: %v", err) | ||
| } |
There was a problem hiding this comment.
We have to delete the tag first and only then the manifest, not otherwise (as the tag would be deleted after deleting the manifest). That's why I'm moving this higher up.
This test was not failing until now because we were ignoring not found errors (see #3427 (comment)).
| if err := ts.blobStore.driver.Delete(ctx, tagPath); err != nil { | ||
| switch err.(type) { | ||
| case storagedriver.PathNotFoundError: | ||
| return nil // Untag is idempotent, we don't care if it didn't exist |
There was a problem hiding this comment.
This is no longer true. We must respond with 404 Not Found if a tag is not found at the API level. So returning the error here and letting the caller decide what to do with it.
milosgajdos
left a comment
There was a problem hiding this comment.
LGTM, I only have one question I'd like to get cleared up.
Signed-off-by: João Pereira <484633+joaodrp@users.noreply.github.com>
Signed-off-by: João Pereira <484633+joaodrp@users.noreply.github.com>
registry/handlers/manifests.go
Outdated
| case distribution.ErrTagUnknown, driver.PathNotFoundError: | ||
| imh.Errors = append(imh.Errors, v2.ErrorCodeManifestUnknown) | ||
| default: | ||
| imh.Errors = append(imh.Errors, errcode.ErrorCodeUnknown) |
There was a problem hiding this comment.
it's better to append the details, errcode.ErrorCodeUnknown.WithDetail(err)
|
|
||
| if imh.Tag != "" { | ||
| tagService := imh.Repository.Tags(imh.Context) | ||
| if err := tagService.Untag(imh.Context, imh.Tag); err != nil { |
There was a problem hiding this comment.
add log here? dcontext.GetLogger(imh).Debug("DeleteImageTag")
Signed-off-by: João Pereira <484633+joaodrp@users.noreply.github.com>
|
Hi, hem it does not seems to me that this merge is included in 2.8.0.beta1? I looked at the changelog and can't find it. Even https://docs.docker.com/registry/spec/api/#detail does not include the doc modification. ping @milosgajdos maybe? Thank you. |
|
@antoinetran no, it isn't in |
|
@milosgajdos @wy65701436 Where can i see documentation about, Delete image by tag. in V2. |
|
@chethankumar4046 this PR diff will show you where the docs are. It pays off looking into diffs. |
|
@milosgajdos I gone through PR But I need more clarification Because i see some open ticket and I tried above method but it deleted my whole image, |
|
@milosgajdos this fix doesn't seem to be released currently in any of the 2.x released versions (at least according to the release notes). Is there a plan of releasing it in version 2.x at some point? If yes, I was wondering if there's any optimistic timeline for this. Or if there's a milestone for releasing a stable 3.x version |
Correct.
The original plan was by the end of this year but as you may have noticed we have 10+ maintainers on this repo and I'm the only one active. Or I was until I gave up on chasing the others, so no ETA. |
I see. Thanks for the update! |
The tag delete API operation has finally made it to the OCI Distribution spec, in v1.0.0 (source). This PR makes the required changes to incorporate such functionality.
Signed-off-by: João Pereira 484633+joaodrp@users.noreply.github.com