Skip to content

Commit

Permalink
fix: ignore metadb errors if tag not found (#2301)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchincha authored Mar 13, 2024
1 parent c7472a2 commit fdb4012
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func (rh *RouteHandler) GetManifest(response http.ResponseWriter, request *http.

if rh.c.MetaDB != nil {
err := meta.OnGetManifest(name, reference, mediaType, content, rh.c.StoreController, rh.c.MetaDB, rh.c.Log)
if err != nil {
if err != nil && !errors.Is(err, zerr.ErrImageMetaNotFound) {
response.WriteHeader(http.StatusInternalServerError)

return
Expand Down
2 changes: 1 addition & 1 deletion pkg/meta/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func OnDeleteManifest(repo, reference, mediaType string, digest godigest.Digest,
return nil
}

// OnDeleteManifest is called when a manifest is downloaded. It increments the download couter on that manifest.
// OnGetManifest is called when a manifest is downloaded. It increments the download couter on that manifest.
func OnGetManifest(name, reference, mediaType string, body []byte,
storeController storage.StoreController, metaDB mTypes.MetaDB, log log.Logger,
) error {
Expand Down
6 changes: 6 additions & 0 deletions test/blackbox/annotations.bats
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ function teardown_file() {
[ "$status" -eq 0 ]
local sigName=$(echo "${lines[-1]}" | jq '.[].critical.image."docker-manifest-digest"')
[[ "$sigName" == *"${digest}"* ]]
tags=( $(oras repo tags --plain-http localhost:${zot_port}/annotations) )
[ "$status" -eq 0 ]
local sigdes=$(oras manifest fetch --descriptor localhost:${zot_port}/annotations:${tags[1]} | jq .digest | tr -d \")
[ "$status" -eq 0 ]
run oras manifest fetch --plain-http localhost:${zot_port}/annotations@${sigdes}
[ "$status" -eq 0 ]
}

@test "sign/verify with cosign (only referrers)" {
Expand Down

0 comments on commit fdb4012

Please sign in to comment.