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

index with subject but contains no artifactType #1106

Closed
qweeah opened this issue Aug 16, 2023 · 9 comments
Closed

index with subject but contains no artifactType #1106

qweeah opened this issue Aug 16, 2023 · 9 comments
Milestone

Comments

@qweeah
Copy link

qweeah commented Aug 16, 2023

OCI image spec 1.1.0-rc4 allows image index to have subject(updated in this commit) and artifactType(update in this commit). Since both fields are optional, it's possible that user can push an index with subject but no artifactType like below.

flowchart
index --subject--> image
Loading

Should we enforce the requirement on both fields like: if subject is presented, artifactType MUST be presented, otherwise the index is invalid?

@qweeah
Copy link
Author

qweeah commented Aug 16, 2023

Also created an issue on distribution-spec side opencontainers/distribution-spec#458 since it's related to the implementation of referrers API and tag-schema fallback.

@sudo-bmitch sudo-bmitch added this to the v1.1.0 milestone Aug 16, 2023
@sudo-bmitch
Copy link
Contributor

sudo-bmitch commented Aug 16, 2023

This is related to #1020 and #1077. CC @vbatts and @sajayantony from those PRs.
Edit: adding #1066.

@sajayantony
Copy link
Member

Is this stemming from the fact that the artifact Type is a MUST from the referreres API ?
https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers
This doesn't handle the index case and maybe we should clarify that subject and artifactType are required for Index if we want to support index in the referrers API. @vbatts @jonjohnsonjr

@qweeah
Copy link
Author

qweeah commented Aug 17, 2023

Is this stemming from the fact that the artifact Type is a MUST from the referrers API?

Yes.

if we want to support index in the referrers API

Good catch. Index with subject should be included in the referrers API, otherwise user cannot find the referrer index from the subject manifest and there is no meaning to set subject, right? What I suggest is: artfactType MUST present if subject presents.

@sudo-bmitch
Copy link
Contributor

I'd be curious how to write the json schema for that. Is there a "conditional required" syntax? Ref:

@tianon
Copy link
Member

tianon commented Aug 17, 2023

Wouldn't that be dependentRequired?
(https://json-schema.org/understanding-json-schema/reference/conditionals.html)

  "dependentRequired": {
    "subject": ["artifactType"]
  }

@sajayantony
Copy link
Member

From the call today there were multiple options discussed of from making artifactType a MUST, to making it optional in the referrers. The second option sounded like there was more acceptance which would be a change to the distribution spec.
There needs to be a follow up PR on the distribution spec and it also means that there is no PR expected for the image spec at this point.

@qweeah
Copy link
Author

qweeah commented Aug 18, 2023

to making it optional in the referrers. The second option sounded like there was more acceptance which would be a change to the distribution spec.

Can you help elaborate on what's the motivation for this preference of making it optional? Will it also be applied to image referrer descriptors?

Synced offline with @sajayantony, making artifactType optional for referrers requires less on server side and distributions can skip filling the field if filtering is not supported. Such change can be applied to image referrers.

@qweeah
Copy link
Author

qweeah commented Aug 29, 2023

Closing as it should be fixed by making artifact type optional in the Referrers API in distribution-spec. Let's continue the discussion in opencontainers/distribution-spec#458

@qweeah qweeah closed this as completed Aug 29, 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

No branches or pull requests

4 participants