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

define media type for oci-layout #610

Merged
merged 3 commits into from
Mar 20, 2017
Merged

define media type for oci-layout #610

merged 3 commits into from
Mar 20, 2017

Conversation

xiekeyang
Copy link
Contributor

@xiekeyang xiekeyang commented Mar 13, 2017

Following #579.

To add a new specific media type for oci-layout, serving over its transportation.

Signed-off-by: xiekeyang xiekeyang@huawei.com

@vbatts
Copy link
Member

vbatts commented Mar 13, 2017

or should we just give it a mediaType, @stevvooe ?

@jonboulle
Copy link
Contributor

That seems simpler than going through these contortions.

@stevvooe
Copy link
Contributor

@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.

@xiekeyang
Copy link
Contributor Author

@vbatts @jonboulle @stevvooe

I change the clarification on d678b9c

I prefer to naming the file as oci-layout, instead of providing a media type. In layout use case of a variety of different transport mechanisms, we check other JSON objects through media type because they are CAS blobs, but image-layout is always on the top of image dir, so that users can address it through name of oci-layout. And I think it might be applicable on local or repository endpoint.

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`
Copy link
Contributor

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).

Copy link
Contributor

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.
Copy link
Contributor

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

@xiekeyang
Copy link
Contributor Author

@jonboulle @wking
I had wanted to present 3 supplements according to previous confusion and discussion.

  1. oci-layout is unchangeable. (It seems redundant to add any comment, so that I removed it)
  2. This section defines none of media type. I think it might make sense, for this JSON object has seem to confuse developers try to find its media type. Then I want to clear it here.
  3. How image provider or consumer to address/handle oci-layout, this seems to be acceptable.

@xiekeyang
Copy link
Contributor Author

@jonboulle @wking These clarification might be not graceful, could you suggest some better words? Thanks.

@wking
Copy link
Contributor

wking commented Mar 15, 2017 via email

@xiekeyang
Copy link
Contributor Author

@wking I'm not opposing specific oci-layout media type strongly. I'm just considering #610 (comment) .
Spec declares that This layout MAY be used in a variety of different transport mechanisms. In this case if it really need media type? I suspect it. For validation purpose, I have said some times that we should improve validation code, instead set up a media type. (Maybe in future we will need specific media type, I'm not sure.)

So I like the language:

This specification does not declare a specific media type for `oci-layout`, so it is the generic [`application/json`](https://tools.ietf.org/html/rfc7159#section-1.2).

This patch I would like to achieve in spec, then I will follow up patch on validation part for this.

@xiekeyang
Copy link
Contributor Author

Updated in 70d7a61

@jonboulle
Copy link
Contributor

I'm lost. I thought we established we would just add the media type.

@xiekeyang xiekeyang changed the title oci-layout is not media type define media type for image layout Mar 16, 2017
Signed-off-by: xiekeyang <xiekeyang@huawei.com>
@xiekeyang
Copy link
Contributor Author

xiekeyang commented Mar 16, 2017

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 ImageLayoutFile even it is not used currently. That is because the name (oci-layout) will be use by image-tools or customers when they pack the OCI image.

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).
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

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.

@stevvooe
Copy link
Contributor

Media type needs to be registered in https://github.com/opencontainers/image-spec/blob/master/media-types.md, as well.

@xiekeyang
Copy link
Contributor Author

@stevvooe

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?

@xiekeyang xiekeyang changed the title define media type for image layout define media type for oci-layout Mar 17, 2017
@xiekeyang
Copy link
Contributor Author

@opencontainers/image-spec-maintainers I rename the oci-layout media type to application/vnd.oci.layout.version.v1+json. That express precisely the oci-layout itself, to avoid confusing customers. PTAL, thanks. Related changeset is done in media-type.md, schema and spec/v1.

@stevvooe
Copy link
Contributor

@xiekeyang Thanks! application/vnd.oci.layout.version.v1+json is much clearer. Perhaps, pplication/vnd.oci.layout.header.v1+json might be even more accurate?

@jonboulle @vbatts Thoughts?

xiekeyang added 2 commits March 18, 2017 18:42
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>
@xiekeyang
Copy link
Contributor Author

Perhaps, pplication/vnd.oci.layout.header.v1+json might be even more accurate?

I like it! related name is updated, PTAL.

@jonboulle
Copy link
Contributor

sure, this is fine with me.

@jonboulle
Copy link
Contributor

jonboulle commented Mar 20, 2017

lgtm

Approved with PullApprove


### oci-layout Example

```json,title=OCI%20Layout&mediatype=oci%2Dlayout
```json,title=OCI%20Layout&mediatype=application/vnd.oci.layout.header.v1%2Bjson
Copy link
Member

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?

Copy link
Contributor

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).

Copy link
Member

Choose a reason for hiding this comment

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

right on

@vbatts
Copy link
Member

vbatts commented Mar 20, 2017

LGTM

Approved with PullApprove

@vbatts vbatts merged commit d24a3c9 into opencontainers:master Mar 20, 2017
@vbatts vbatts mentioned this pull request May 19, 2017
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.

5 participants