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

Remove references to schema1 pacakge from storage #4002

Merged
merged 2 commits into from Aug 28, 2023

Conversation

davidspek
Copy link
Collaborator

@davidspek davidspek commented Aug 18, 2023

Part of: #3966

This PR is a step towards the elimination of schema v1 support in distribution.

This PR removes schema1 package references from the registry/storage package.

@davidspek davidspek added this to the Registry/3.0.0 milestone Aug 18, 2023
@Jamstah Jamstah marked this pull request as draft August 18, 2023 13:49
@davidspek davidspek force-pushed the remove-schemav1-storage branch 2 times, most recently from 8828101 to 5887c8b Compare August 18, 2023 15:35
@davidspek davidspek marked this pull request as ready for review August 22, 2023 09:53
renovate.json Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2023

Codecov Report

Patch coverage: 60.00% and project coverage change: +0.03% 🎉

Comparison is base (4f7424c) 57.76% compared to head (8e6910b) 57.79%.
Report is 7 commits behind head on main.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4002      +/-   ##
==========================================
+ Coverage   57.76%   57.79%   +0.03%     
==========================================
  Files         108      106       -2     
  Lines       10500    10373     -127     
==========================================
- Hits         6065     5995      -70     
+ Misses       3762     3716      -46     
+ Partials      673      662      -11     
Files Changed Coverage Δ
registry/root.go 13.95% <0.00%> (+1.45%) ⬆️
registry/storage/manifeststore.go 76.74% <ø> (-1.04%) ⬇️
registry/storage/schema2manifesthandler.go 62.35% <0.00%> (ø)
registry/storage/registry.go 86.88% <100.00%> (-1.69%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@milosgajdos milosgajdos left a comment

Choose a reason for hiding this comment

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

I have a small suggestion, otherwise LGTM.

registry/storage/garbagecollect_test.go Outdated Show resolved Hide resolved
@davidspek davidspek force-pushed the remove-schemav1-storage branch 2 times, most recently from b8f9132 to 33befb9 Compare August 25, 2023 09:27
t.Fatal(err)
}
options = append([]RegistryOption{EnableDelete, Schema1SigningKey(k), EnableSchema1}, options...)
options = append(options, EnableDelete)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is now appending to the options slice in the args instead of creating a new slice. If the variadics are passed from an existing slice it will affect the underlying array of the slice.

This is a test function, and an edge case, but should probably be cleaner.

Copy link
Member

Choose a reason for hiding this comment

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

It's only scoped to each individual test that needs to create a registry object - these options are not used anywhere else so it's ok, imho, but yeah we can change it back.

Copy link
Collaborator

@Jamstah Jamstah Aug 26, 2023

Choose a reason for hiding this comment

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

I agree in test code it's really a very minor nit :)

I'd approve without it.

@@ -215,11 +186,21 @@ func TestDeleteManifestIfTagNotFound(t *testing.T) {
t.Fatalf("failed to make layers: %v", err)
}

digests1 := []digest.Digest{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this related to schema1 removal? schema1 took layers and schema2 takes manifests?

Copy link
Member

Choose a reason for hiding this comment

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

the original coode was calling getKeys(randomLayers1) and getKeys(randomLayers2) when passing the params to estutil.MakeSchema1Manifest; we could have kept that helper maybe; this code just makes it explicit because getKeys was removed (I'm assuming as part of the removal of testutil.MakeSchema1Manifest calls, and then never put back leading to this code. But this code is needed to pass the digests down to testutil.MakeSchema2Manifest instead of the schema1 estutil.MakeSchema1Manifest call. Maybe a bit of an oversight but not incorrect. @davidspek do you wanna put back getKeys and then pass getKeys(randomlayers[12]) down to schema2 manifet func

Copy link
Collaborator

Choose a reason for hiding this comment

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

That comment was more for my understanding than a request for change, happy to go with either style.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should put that func (getKeys) back either way. This is a great catch even if we arrived at it by tangent 🙃

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added back the getKeys() function and am passing that to testutil.MakeSchema2Manifest now.

registry/storage/manifeststore_test.go Outdated Show resolved Hide resolved
registry/storage/manifeststore_test.go Outdated Show resolved Hide resolved
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Copy link
Collaborator

@Jamstah Jamstah left a comment

Choose a reason for hiding this comment

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

Much cleaner, thanks.

@milosgajdos milosgajdos merged commit 932be63 into distribution:main Aug 28, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants