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

cosign clean: Don't log failure if the registry responds with 404 #1687

Merged
merged 2 commits into from
Mar 30, 2022

Conversation

imjasonh
Copy link
Member

remote.Delete expects either a 200 or 202, but if the tag doesn't exist
in the registry, some registries (seemingly ECR, maybe others) respond
with a 404, which just means there was nothing to delete.

This change also refactors logging to only log if the deletion was
successful, to avoid confusion if we can tell the tag didn't exist
before cleaning.

Signed-off-by: Jason Hall jasonhall@redhat.com

Fixes #1684

cosign clean doesn't log failure to delete a non-existent tag when the registry responds with a 404.

remote.Delete expects either a 200 or 202, but if the tag doesn't exist
in the registry, some registries (seemingly ECR, maybe others) respond
with a 404, which just means there was nothing to delete.

This change also refactors logging to only log if the deletion was
successful, to avoid confusion if we can tell the tag didn't exist
before cleaning.

Signed-off-by: Jason Hall <jasonhall@redhat.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2022

Codecov Report

Merging #1687 (d39a8ed) into main (e2017af) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1687      +/-   ##
==========================================
- Coverage   29.29%   29.24%   -0.06%     
==========================================
  Files         140      140              
  Lines        8370     8375       +5     
==========================================
- Hits         2452     2449       -3     
- Misses       5652     5659       +7     
- Partials      266      267       +1     
Impacted Files Coverage Δ
cmd/cosign/cli/clean.go 0.00% <0.00%> (ø)
pkg/cosign/tuf/client.go 62.34% <0.00%> (-0.95%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2017af...d39a8ed. Read the comment docs.

Signed-off-by: Jason Hall <jasonhall@redhat.com>
@dlorenc dlorenc merged commit 9ccf708 into sigstore:main Mar 30, 2022
@github-actions github-actions bot added this to the v1.7.0 milestone Mar 30, 2022
mlieberman85 pushed a commit to mlieberman85/cosign that referenced this pull request May 6, 2022
…gstore#1687)

* cosign clean: Don't log failure if the registry responds with 404

remote.Delete expects either a 200 or 202, but if the tag doesn't exist
in the registry, some registries (seemingly ECR, maybe others) respond
with a 404, which just means there was nothing to delete.

This change also refactors logging to only log if the deletion was
successful, to avoid confusion if we can tell the tag didn't exist
before cleaning.

Signed-off-by: Jason Hall <jasonhall@redhat.com>

* fix lint error, use errors.As like cosign copy does

Signed-off-by: Jason Hall <jasonhall@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cosign clean gives 404 with AWS ECR and KMS
3 participants