Skip to content

Conversation

thaJeztah
Copy link
Member

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2022

Codecov Report

Base: 57.06% // Head: 57.06% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (43e8027) compared to base (c47a966).
Patch coverage: 78.33% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3777   +/-   ##
=======================================
  Coverage   57.06%   57.06%           
=======================================
  Files         105      106    +1     
  Lines       10806    10838   +32     
=======================================
+ Hits         6166     6185   +19     
- Misses       3952     3964   +12     
- Partials      688      689    +1     
Impacted Files Coverage Δ
configuration/configuration.go 64.38% <ø> (ø)
context/trace.go 93.47% <ø> (ø)
contrib/token-server/main.go 0.00% <0.00%> (ø)
manifest/ocischema/manifest.go 74.19% <ø> (ø)
manifest/schema1/manifest.go 33.82% <ø> (ø)
manifest/schema1/reference_builder.go 94.00% <ø> (ø)
manifest/schema2/manifest.go 80.00% <ø> (-0.40%) ⬇️
reference/reference.go 79.08% <ø> (ø)
registry/api/errcode/register.go 30.76% <ø> (ø)
registry/api/v2/descriptors.go 100.00% <ø> (ø)
... and 37 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@brackendawson
Copy link
Contributor

Should Sort() have a Fuzzer for oss-fuzz to test?

@thaJeztah
Copy link
Member Author

Perhaps 🤔 that said, there's no fuzzers currently running on this package in containerd (where this comes from). Perhaps it would be good to add them once (IF depends in wether the maintainers accept that) this package is moved to a separate module; see #3587 (comment)

@brackendawson
Copy link
Contributor

That sounds like a good plan, it also means you don't need to worry about whatever #3780 does to the fuzzers in this repo.

@milosgajdos milosgajdos requested a review from corhere November 8, 2022 20:02
@corhere
Copy link
Collaborator

corhere commented Nov 8, 2022

The code LGTM, though the commit history is going to confuse the heck out of future code archaeologists. The "Fix reference ordering" commit is entirely greenfield code, and the two "Move x to y package" commits do nothing of the sort. WDYT about squashing this PR down to one commit with a description like "reference: implement Sort()" @thaJeztah?

@thaJeztah
Copy link
Member Author

WDYT about squashing this PR down to one commit with a description like "reference: implement Sort()"

Yes, works for me; I had my branch squashed locally, then last minute wasn't sure wether or not I should squash, or to try to keep contributor history, but I guess it's ok to squash. I could include a link to the original implementation in the commit message.

This upstreams `Sort()` as originally implemented in containerd in
https://github.com/containerd/containerd/0886ceaea2470edc7339dfc5ebe0e3257ae84d06

From that commit:

> Fix reference ordering in CRI image store
>
> Currently image references end up being stored in a
> random order due to the way maps are iterated through
> in Go. This leads to inconsistent identifiers being
> resolved when a single reference is needed to identify
> an image and the ordering of the references is used for
> the selection.
>
> Sort references in a consistent and ranked manner,
> from higher information formats to lower.
>
> Note: A `name + tag` reference is considered higher
> information than a `name + digest` reference since a
> registry may be used to resolve the digest from a
> `name + tag` reference.

Co-Authored-by: Derek McGowan <derek@mcg.dev>
Co-Authored-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the reference_add_sorting branch from 43e8027 to 1052518 Compare November 8, 2022 21:42
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.

6 participants