-
Notifications
You must be signed in to change notification settings - Fork 687
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
define media type for oci-layout #610
Conversation
or should we just give it a mediaType, @stevvooe ? |
That seems simpler than going through these contortions. |
@vbatts @jonboulle I agree that is simpler. We do need to be careful about contexts under which a mediatype is encountered. For example, I would never expect to encounter this in the course of arbitrary descriptors, so we may want to add some clarification that you only need to handle these when it is an oci layout file. |
I change the clarification on d678b9c I prefer to naming the file as If it is reasonable? |
image-layout.md
Outdated
@@ -20,6 +22,7 @@ The image layout is as follows: | |||
- See [blobs](#blobs) section | |||
- `oci-layout` file | |||
- It MUST exist | |||
- Its name MUST be `oci-layout` |
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 is already covered by the earlier - oci-layout file
line. Note that we have no Its name MUST be blobs
entry under - blobs directory
above (for the same reason).
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.
+1
image-layout.md
Outdated
@@ -2,6 +2,8 @@ | |||
|
|||
The OCI Image Layout is a slash separated layout of OCI content-addressable blobs and [location-addressable](https://en.wikipedia.org/wiki/Content-addressable_storage#Content-addressed_vs._location-addressed) references (refs). | |||
This layout MAY be used in a variety of different transport mechanisms: archive formats (e.g. tar, zip), shared filesystem environments (e.g. nfs), or networked file fetching (e.g. http, ftp, rsync). | |||
This section defines none of media type for image layout. |
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 this necessary? its inclusion just confuses me. a layout as described here couldn't really have a media type
@jonboulle @wking
|
@jonboulle @wking These clarification might be not graceful, could you suggest some better words? Thanks. |
On Tue, Mar 14, 2017 at 06:50:47PM -0700, xiekeyang wrote:
@jonboulle @wking These clarification might be not graceful, could
you suggest some better words? Thanks.
I don't think it's a good idea to declare that there is *no* media
type for oci-layout. If you're serving an image-layout over HTTP,
you'll want to put something in the Content-Type header for that file.
If we don't give it a more specific media type, then it will default
to being application/json [1]. So there are two options for the type:
a. Declare a specific media type for the oci-layout file
(e.g. application/vnd.oci.image.layout.v1+json).
b. Use application/json.
With (a) we can continue to use our current media-type based spec
validation [2,3] without trouble. With (b), we have two validation
options:
i. Use a dummy “media type” like oci-layout [4,5].
ii. Add a new field (independent of or supporting the media type) to
select which schema should be used to validate the content
(e.g. json,title=OCI%20Layout&mediatype=application/json&schema=oci%2Dlayout).
I prefer (a), (b.ii) is ok, and (b.i) (the route taken in #519, #579, and
this PR as of c0362a3) just seems confusing to me.
So if you want to make it clear that we are declaring no special media
type for this file (b), I'd suggest a line like:
This specification does not declare a specific media type for
`oci-layout`, so the media type for `oci-layout` is the generic
[`application/json`][1].
But if we go that route, I'd strongly recommend we stop pretending to
be using media types to select the appropriate schema for validation
[7]. And that we clearly document the identifiers that we do use
[3], whatever we end up calling them (“schema identifiers”?).
[1]: https://tools.ietf.org/html/rfc7159#section-1.2
[2]: https://github.com/opencontainers/image-spec/blob/v1.0.0-rc5/schema/spec_test.go#L80
[3]: https://github.com/opencontainers/image-spec/blob/v1.0.0-rc5/schema/schema.go#L23-L30
[4]: https://github.com/opencontainers/image-spec/blob/v1.0.0-rc5/schema/schema.go#L29
[5]: https://github.com/opencontainers/image-spec/blob/v1.0.0-rc5/specs-go/v1/layout.go#L19
[6]: https://github.com/opencontainers/image-spec/pull/579/files#diff-99bfcb610f238b942638d49d1ff2eaf4R137
[7]: https://github.com/opencontainers/image-spec/blob/v1.0.0-rc5/schema/schema.go#L23
|
@wking I'm not opposing specific oci-layout media type strongly. I'm just considering #610 (comment) . So I like the language:
This patch I would like to achieve in spec, then I will follow up patch on validation part for this. |
Updated in 70d7a61 |
I'm lost. I thought we established we would just add the media type. |
Signed-off-by: xiekeyang <xiekeyang@huawei.com>
Here are 3 commits. According to most people's suggestion, this add specific media type for image layout in b7e8d5c After that, image layout key word in schema should be updated accordingly, which I fix in b8e832d . Here I didn't remove During making lint I encounter failure. It not caused the above commit, but failure under any commit. So I've to extent the deadline of lint fro 10s to 15s, in eb5fcf8 . @opencontainers/image-spec-maintainers PTAL, thank so much! |
image-layout.md
Outdated
@@ -2,6 +2,7 @@ | |||
|
|||
* The OCI Image Layout is a slash separated layout of OCI content-addressable blobs and [location-addressable](https://en.wikipedia.org/wiki/Content-addressable_storage#Content-addressed_vs._location-addressed) references (refs). | |||
* This layout MAY be used in a variety of different transport mechanisms: archive formats (e.g. tar, zip), shared filesystem environments (e.g. nfs), or networked file fetching (e.g. http, ftp, rsync). | |||
* This section defines the `application/vnd.oci.image.layout.v1+json` [media type](media-types.md). |
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 line should be moved down here to the oci-layout-file section. Otherwise it seems to imply that the entire document is talking about this 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.
I think this line should be moved down here to the oci-layout-file section. Otherwise it seems to imply that the entire document is talking about this media type.
I'm a little doubting on it. It seems had better to be aligned with other spec docs (manifest, index, config..), in which define ... media type
is put on the first section.
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 see what you mean, but would also argue that it's more appropriate in those other documents because there the bulk of the text is describing the type, whereas in this case it's only a small part of the document. But ¯_(ツ)_/¯ , other maintainers can weigh in
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.
Also, if we created a mediatype for the layout archive, it would probably be this, so this is very confusing.
Media type needs to be registered in https://github.com/opencontainers/image-spec/blob/master/media-types.md, as well. |
I've registered it in b7e8d5c#diff-691102624fa3cbd2452c05ada4a3f91cR6 . Do you mean that way? |
@opencontainers/image-spec-maintainers I rename the oci-layout media type to |
@xiekeyang Thanks! @jonboulle @vbatts Thoughts? |
To add a new specific media type for oci-layout, serving over its transportation. Signed-off-by: xiekeyang <xiekeyang@huawei.com>
As we have defined media type for oci-layout, now we can use it as the key word in schema map. Signed-off-by: xiekeyang <xiekeyang@huawei.com>
I like it! related name is updated, PTAL. |
sure, this is fine with me. |
|
||
### oci-layout Example | ||
|
||
```json,title=OCI%20Layout&mediatype=oci%2Dlayout | ||
```json,title=OCI%20Layout&mediatype=application/vnd.oci.layout.header.v1%2Bjson |
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.
will the TestValidateImageLayout
in ./schema/spec_test.go
test this now?
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 have been testing this example since #579:
$ git describe
v1.0.0-rc5-68-gf59a917
$ sed -i 's/imageLayoutVersion/iLV/' image-layout.md
$ go test ./schema/spec_test.go
{
"iLV": "1.0.0"
}
---
--- FAIL: TestValidateImageLayout (0.00s)
spec_test.go:190: invalid oci-layout OCI Layout
spec_test.go:100: imageLayoutVersion: imageLayoutVersion is required
…
What this PR does is give us a better identifier for this validator (application/vnd.oci.layout.header.v1+json
) than the current one (oci-layout
).
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.
right on
Following #579.
To add a new specific media type for oci-layout, serving over its transportation.
Signed-off-by: xiekeyang xiekeyang@huawei.com