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

feat: add type for failure during deleting dangling referrer index #482

Merged
merged 19 commits into from
Apr 27, 2023

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Apr 11, 2023

Resolves #479

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2023

Codecov Report

Merging #482 (be342e1) into main (e8225cb) will increase coverage by 0.08%.
The diff coverage is 63.63%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #482      +/-   ##
==========================================
+ Coverage   72.84%   72.92%   +0.08%     
==========================================
  Files          49       49              
  Lines        4518     4528      +10     
==========================================
+ Hits         3291     3302      +11     
  Misses        919      919              
+ Partials      308      307       -1     
Impacted Files Coverage Δ
registry/remote/referrers.go 92.04% <33.33%> (-4.30%) ⬇️
registry/remote/repository.go 68.87% <100.00%> (+0.64%) ⬆️

registry/remote/referrers.go Outdated Show resolved Hide resolved
registry/remote/referrers.go Outdated Show resolved Hide resolved
registry/remote/referrers.go Outdated Show resolved Hide resolved
qweeah added 2 commits April 11, 2023 17:13
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sajayantony
Copy link
Contributor

Is the digest of the manifest that failed to be deleted included in the errro?

Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Although please answer Sajay's question. Digest appears to be included to me.

@SteveLasker
Copy link
Contributor

I'm struggling to understand why we'd delete content for the user: #479 (comment)

@qweeah
Copy link
Contributor Author

qweeah commented Apr 12, 2023

Is the digest of the manifest that failed to be deleted included in the error?

It implicitly implied in the ReferrersTag, will add subject descriptor so caller don't need to do reversed conversion for referrers tag schema.

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we may have more specific errors in the future. It would be better if we can introduce a generic error to avoid error type blow up.

A sample error can be

type ReferrersError struct {
    Op      string
    Subject ocispec.Descriptor
    Err     error
}

Other examples can be found by

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah
Copy link
Contributor Author

qweeah commented Apr 12, 2023

type ReferrersError struct {
    Op      string
    Subject ocispec.Descriptor
    Err     error
}

Updated, made it more generic to a remote.IgnorableError, not only for referrers.

@sajayantony
Copy link
Contributor

Ignorable is confusing to me. It’s up to the caller to decide that IMHO.

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
registry/remote/referrers.go Outdated Show resolved Hide resolved
registry/remote/errop/errors.go Outdated Show resolved Hide resolved
registry/remote/referrers.go Outdated Show resolved Hide resolved
registry/remote/errop/errors.go Outdated Show resolved Hide resolved
qweeah added 2 commits April 13, 2023 16:52
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qweeah It would be better if we can have a runnable example to show how this error can be parsed. Basically, we can have a mock registry which does not support delete.

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
registry/remote/referrers.go Outdated Show resolved Hide resolved
registry/remote/referrers.go Outdated Show resolved Hide resolved
qweeah added 2 commits April 15, 2023 07:46
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
qweeah added 2 commits April 23, 2023 15:50
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
qweeah added 2 commits April 24, 2023 23:48
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

registry/remote/referrers.go Outdated Show resolved Hide resolved
registry/remote/example_test.go Outdated Show resolved Hide resolved
qweeah added 3 commits April 27, 2023 03:07
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Wwwsylvia Wwwsylvia merged commit b74a2a1 into oras-project:main Apr 27, 2023
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.

Feature Request: err type for dangling referrers index deletion failure
7 participants