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

Add an extensions API endpoint for downloading signatures #527

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

lubosmj
Copy link
Member

@lubosmj lubosmj commented Jan 10, 2022

closes #504

@lubosmj lubosmj force-pushed the extension-live-api-504 branch 2 times, most recently from fd7e098 to a3a0622 Compare January 10, 2022 09:01
class Signatures(ContainerRegistryApiMixin, ViewSet):
"""A ViewSet for image signatures."""

lookup_value_regex = "sha256:[0-9a-f]+"
Copy link
Member

Choose a reason for hiding this comment

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

Let's be specific:

Suggested change
lookup_value_regex = "sha256:[0-9a-f]+"
lookup_value_regex = "sha256:[0-9a-f]{64}"

@lubosmj lubosmj force-pushed the extension-live-api-504 branch from a3a0622 to fe7ef04 Compare January 10, 2022 11:12
@lubosmj lubosmj marked this pull request as draft January 10, 2022 12:02
@lubosmj lubosmj force-pushed the extension-live-api-504 branch from fe7ef04 to b0ccb77 Compare January 10, 2022 12:20
@lubosmj lubosmj marked this pull request as ready for review January 10, 2022 12:20
headers.update(
{
"Docker-Distribution-Api-Version": "registry/2.0",
"X-Registry-Supports-Signatures": "1",
Copy link
Member

Choose a reason for hiding this comment

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

This header name is already defined in stages file https://github.com/pulp/pulp_container/blob/signing/pulp_container/app/tasks/sync_stages.py#L43, how about putting it into the constants and using it here and there?

@lubosmj lubosmj force-pushed the extension-live-api-504 branch from b0ccb77 to ce6155f Compare January 10, 2022 15:25
@lubosmj lubosmj force-pushed the extension-live-api-504 branch from ce6155f to 612e552 Compare January 11, 2022 23:23
data = []
for signature in signatures:
signature = {
"schemaVersion": 2,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@goosemania goosemania Jan 12, 2022

Choose a reason for hiding this comment

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

Good find, "schemaVersion" worked much better!

@ipanova , https://github.com/containers/image/blob/f2c99a9b1a0cd6673aab0d538b48d68562702b04/docker/docker_client.go#L76 shows in the comment how json is being serialized, and that it's this string and not the attribute name is used. But it is confusing, why not to make them the same 🤷‍♀️

Copy link
Member

Choose a reason for hiding this comment

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

ok that's confusing as hell

Copy link
Member Author

Choose a reason for hiding this comment

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

Version stands for a parsed value. A raw JSON value is stored as "schemaVersion".

@lubosmj lubosmj merged commit 06d9945 into pulp:signing Jan 12, 2022
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.

4 participants