-
Notifications
You must be signed in to change notification settings - Fork 45
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 the manifest schema conversion machinery #1529
Remove the manifest schema conversion machinery #1529
Conversation
aa81c74
to
9582ef9
Compare
unittest_requirements.txt
Outdated
@@ -2,3 +2,4 @@ mock | |||
pytest-django | |||
pulp-smash @ git+https://github.com/pulp/pulp-smash.git | |||
pytest<8 | |||
pyjwkest>=1.4,<=1.4.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum... I probably had issues before removing the test_convert.py file:
https://github.com/pulp/pulp_container/pull/1529/files#diff-2f5092e427a2a7997e2ce75c8c252cbd9d3d30b33f2ab32dbe1b241194de98bdL6
I just tried again without it and had no dependency errors. Removing it.
@@ -186,6 +192,11 @@ def fetch_response_metadata(self, response): | |||
if DEFAULT_FILE_STORAGE in STANDARD_FILE_STORAGE_FRAMEWORKS: | |||
return response.status_code, response.headers.get("X-PULP-CACHE") | |||
else: | |||
"""Corner case for deprecated v2 schema1""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which corner cases are we catching here? I thought that we were dealing only with manifest v2 schema 2 content inside this test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember now, but it was probably an error in test_05_different_headers.
I'm rerunning the tests without this block to confirm that the "corner case" was actually because of wrong headers in my tests.
pulp_container/app/registry.py
Outdated
@@ -231,6 +229,11 @@ async def dispatch_tag(self, request, tag, response_headers): | |||
streamed back to the client. | |||
|
|||
""" | |||
# return 404 in case the client is requesting docker manifest v2 schema 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part is not required inside dispatch_tag
. How about we remove the code and add the highlighted comment just above the raise PathNotResolved
call placed at the end of the get_tag
method? So, we will not forget about the rationale behind raising the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part is not required inside dispatch_tag.
Agreed. I added this part when I was having issues with the test_05_different_headers and setting "wrong headers". I'm rerunning the tests without this modification in dispatch_tag and will check if the tests will pass.
How about we remove the code and add the highlighted comment just above the raise PathNotResolved call placed at the end of the get_tag method? So, we will not forget about the rationale behind raising the exception.
Good idea!
9582ef9
to
585fea6
Compare
you forgot about redirects.py file, we should not 302-->404 but raise 404 right away |
CHANGES/1509.removal
Outdated
@@ -0,0 +1,2 @@ | |||
Removed the manifest schema conversion machinery. This change also removes the ``pyjwkest`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we expand more on what it means?
e.g. Removed the manifest schema conversion machinery. If the manifest is stored locally in the newer format and old clients request v2 schema1 manifest they will receive 404.
v2 schema1 manifest is still going to be mirrored from remote source during sync if available and passed to the old clients on the request.
585fea6
to
eba4735
Compare
pulp_container/app/registry_api.py
Outdated
if media_type == MEDIA_TYPE.MANIFEST_V1: | ||
raise ManifestNotFound(reference=pk) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a manifest's media type is MEDIA_TYPE.MANIFEST_V1
, we should not raise ManifestNotFound
. Instead, let's return the manifest because we have got the same media type as requested by a user. Also, the media_type
variable can contain comma separated values.
pulp_container/app/registry_api.py
Outdated
@@ -962,6 +970,9 @@ def get(self, request, path, pk): | |||
@RegistryApiCache(base_key=lambda req, cac: find_base_path_cached(req, cac)) | |||
def handle_safe_method(self, request, path, pk): | |||
"""Handles safe requests for Blobs.""" | |||
# Fail early in case of unsupported manifest schemas | |||
self.handle_old_manifest_version(request.accepted_media_type, pk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not care about media types when it comes to blobs. You can safely remove this check here.
eba4735
to
a30f1d9
Compare
pulp_container/app/redirects.py
Outdated
manifest_media_type not in get_accepted_media_types(self.request.headers) | ||
and manifest_media_type != MEDIA_TYPE.MANIFEST_V1 | ||
): | ||
raise Http404("Unsupported manifest version: %s" % manifest_media_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried raising ManifestNotFound
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum....not yet after this change.
I'll try it!
CHANGES/1509.removal
Outdated
format and old clients request v2 schema1 manifest they will receive 404. v2 schema1 manifest is | ||
still going to be mirrored from remote source during sync if available and passed to the old clients | ||
on the request. | ||
This change also removed the ``pyjwkest`` dependency, since it is not used anymore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this dependency removal is necessary to announce. @ipanova, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
a30f1d9
to
68c7b91
Compare
pulp_container/app/redirects.py
Outdated
def issue_tag_redirect(self, tag, pk): | ||
""" | ||
Issue a redirect for the passed tag. | ||
""" | ||
manifest_media_type = tag.tagged_manifest.media_type | ||
if ( | ||
manifest_media_type not in get_accepted_media_types(self.request.headers) | ||
and manifest_media_type != MEDIA_TYPE.MANIFEST_V1 | ||
): | ||
raise ManifestNotFound(reference=pk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use tag.name
instead? If so, there is no need to have a an additional argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you update the staging variant of the documentation, please?
staging_docs/user/tutorials/01-sync-and-host.md
cb6dcc4
to
8958ff7
Compare
@@ -60,7 +68,8 @@ class S3StorageRedirects(CommonRedirects): | |||
|
|||
def issue_tag_redirect(self, tag): | |||
""" | |||
Issue a redirect or perform a schema conversion if an accepted media type requires it. | |||
Issue a redirect if an accepted media type requires it or return not found if manifest | |||
version is not supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your changes are not really related but i noticed and think that we should swap the if/elif branches because if we got schema1 we will not return signed schema as we should
8958ff7
to
8b18ecd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good,thanks!
@lubosmj seems like pull-through tests is failing on azure, a fluke? https://github.com/pulp/pulp_container/actions/runs/8111223816/job/22170105281?pr=1529#step:14:2184 |
I have noticed this. It started failing a couple weeks ago. It might be related to #1493 or artifacts/content being already present in the storage and there is a race condition. I will open an issue for that next week if it occurs again. |
This is test of pull operation and not push, so no. |
Yes, the error is the same as noted in the aforementioned issue:
|
closes: #1509