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

Show artifact type when pushing files #1061

Closed
1 task
qweeah opened this issue Aug 10, 2023 · 12 comments · Fixed by #1320 or #1334
Closed
1 task

Show artifact type when pushing files #1061

qweeah opened this issue Aug 10, 2023 · 12 comments · Fixed by #1320 or #1334
Assignees
Labels
enhancement New feature or request question Further information is requested spec required Issues that require specifications
Milestone

Comments

@qweeah
Copy link
Contributor

qweeah commented Aug 10, 2023

What is the version of your ORAS CLI

1.0.1

What would you like to be added?

When #1009 completes, by default oras push will build an image manifest with artifactType set to --artifact-type. If the flag is not provided, the artifact type will be default application/vnd.unknown.artifact.v1.

When using --image-spec v1.0, the artifact type will be shown in the status of config blob 44136fa355b3

$ oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.0
Preparing foo
Uploading fcde2b2edba5 foo
Uploading 44136fa355b3 application/vnd.unknown.artifact.v1
Uploaded  fcde2b2edba5 foo
Uploaded  44136fa355b3 application/vnd.unknown.artifact.v1
Uploading 89773cad25ff application/vnd.oci.image.manifest.v1+json
Uploaded  89773cad25ff application/vnd.oci.image.manifest.v1+json
Pushed [registry] localhost:5000/test:push
Digest: sha256:89773cad25ffb86bf3c5a535e772ca2bd6a9f81389f598666ca70caceac5a790

When --image-spec is not provided or set to v1.1, the output of oras push doesn't mentioned the used artifact type.

$ oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.1
Preparing foo
Uploading fcde2b2edba5 foo
Uploading 44136fa355b3 application/vnd.oci.empty.v1+json
Uploaded  fcde2b2edba5 foo
Uploaded  44136fa355b3 application/vnd.oci.empty.v1+json
Uploading d7216194f529 application/vnd.oci.image.manifest.v1+json
Uploaded  d7216194f529 application/vnd.oci.image.manifest.v1+json
Pushed [registry] localhost:5000/test:push
Digest: sha256:d7216194f52907f710f123086ea4b1bc91e0664146ac64b205560680ba4cc6bd

When --image-spec is not provided or set to v1.1, the output of oras push should contain which artifact type is used to pack the manifest, below are some suggested changes.

$ # side by side with manifest media type
$ oras push localhost:5000/test:push foo -v --disable-path-validation
Preparing foo
Uploading fcde2b2edba5 foo
Uploading 44136fa355b3 application/vnd.oci.empty.v1+json
Uploaded  fcde2b2edba5 foo
Uploaded  44136fa355b3 application/vnd.oci.empty.v1+json
Uploading d7216194f529 application/vnd.oci.image.manifest.v1+json(application/vnd.unknown.artifact.v1)
Uploaded  d7216194f529 application/vnd.oci.image.manifest.v1+json(application/vnd.unknown.artifact.v1)
Pushed [registry] localhost:5000/test:push
Digest: sha256:d7216194f52907f710f123086ea4b1bc91e0664146ac64b205560680ba4cc6bd

Or

$ # in the pushing summary below digest of manifest
$ oras push localhost:5000/test:push foo -v --disable-path-validation
Preparing foo
Uploading fcde2b2edba5 foo
Uploading 44136fa355b3 application/vnd.oci.empty.v1+json
Uploaded  fcde2b2edba5 foo
Uploaded  44136fa355b3 application/vnd.oci.empty.v1+json
Uploading d7216194f529 application/vnd.oci.image.manifest.v1+json
Uploaded  d7216194f529 application/vnd.oci.image.manifest.v1+json
Pushed [registry] localhost:5000/test:push
Digest: sha256:d7216194f52907f710f123086ea4b1bc91e0664146ac64b205560680ba4cc6bd
Artifact Type: application/vnd.unknown.artifact.v1

Or

$ # print when packing the manifest
$ oras push localhost:5000/test:push foo -v --disable-path-validation
Preparing foo
Preparing d7216194f529(application/vnd.unknown.artifact.v1)
Uploading fcde2b2edba5 foo
Uploading 44136fa355b3 application/vnd.oci.empty.v1+json
Uploaded  fcde2b2edba5 foo
Uploaded  44136fa355b3 application/vnd.oci.empty.v1+json
Uploading d7216194f529 application/vnd.oci.image.manifest.v1+json
Uploaded  d7216194f529 application/vnd.oci.image.manifest.v1+json
Pushed [registry] localhost:5000/test:push
Digest: sha256:d7216194f52907f710f123086ea4b1bc91e0664146ac64b205560680ba4cc6bd

Are you willing to submit PRs to contribute to this feature?

  • Yes, I am willing to implement it.
@qweeah qweeah added the enhancement New feature or request label Aug 10, 2023
@qweeah qweeah added this to the future milestone Aug 10, 2023
@FeynmanZhou
Copy link
Member

For case 3, should we keep the consistent output format with case 1 and put the artifact type behind the digest? For example, d7216194f529 application/vnd.unknown.artifact.v1.

@qweeah
Copy link
Contributor Author

qweeah commented Aug 10, 2023

For case 3, should we keep the consistent output format with case 1 and put the artifact type behind the digest? For example, d7216194f529 application/vnd.unknown.artifact.v1.

Well, original Preparing xxx means file xxx is added to file store. d7216194f529 application/vnd.unknown.artifact.v1 is a bad example since following status shows Uploading d7216194f529 application/vnd.oci.image.manifest.v1+json, user will wonder what's the expected media type of d7216194f529, is it application/vnd.unknown.artifact.v1 or application/vnd.oci.image.manifest.v1+json?

Well, such question proves that proposal 3 is a bad idea.

@FeynmanZhou FeynmanZhou modified the milestones: future, v1.2.0 Aug 18, 2023
@yizha1 yizha1 added the question Further information is requested label Oct 17, 2023
@yizha1 yizha1 modified the milestones: v1.2.0, v1.3.0 Jan 23, 2024
@wangxiaoxuan273
Copy link
Contributor

I'd like to work on this

@shizhMSFT shizhMSFT added the spec required Issues that require specifications label Mar 19, 2024
@FeynmanZhou
Copy link
Member

How about only show artifactType in the output when pushing an OCI v1.1 compliant artifact to the registry as follows:

  • Build and push an OCI v1.1 compliant artifact, artifactType showed in the output:
oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.1
✓ Uploaded  foo                                                                                               91/91  B 100.00%  163ms
  └─ sha256:ab8662bef009e2ec2c84621f9e1a6564188f32bcbbebc9463c09f3113c2a9994
✓ Uploaded  application/vnd.oci.empty.v1+json                                                          2/2  B 100.00%  166ms
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                                      666/666  B 100.00%     0s
  └─ sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79
Pushed [registry] localhost:5000/test:push
ArtifactType: application/vnd.unknown.artifact.v1
Digest: sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79
  • Build and push an OCI v1.0 compliant artifact, no artifactType showed in the output:
oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.0
✓ Uploaded  foo                                                                                               91/91  B 100.00%  163ms
  └─ sha256:ab8662bef009e2ec2c84621f9e1a6564188f32bcbbebc9463c09f3113c2a9994
✓ Uploaded  application/vnd.unknown.config.v1+json                                                              2/2  B 100.00%  166ms
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                                      666/666  B 100.00%     0s
  └─ sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79
Pushed [registry] localhost:5000/test:push
Digest: sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79

@FeynmanZhou
Copy link
Member

A follow-up question, should we also display which type of content (layer, config, artifact, etc) has been uploaded in the output?

For example:

oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.1
✓ Uploaded layer foo                                                                                               91/91  B 100.00%  163ms
  └─ sha256:ab8662bef009e2ec2c84621f9e1a6564188f32bcbbebc9463c09f3113c2a9994
✓ Uploaded config application/vnd.oci.empty.v1+json                                                          2/2  B 100.00%  166ms
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded artifact  application/vnd.oci.image.manifest.v1+json                                                      666/666  B 100.00%     0s
  └─ sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79
Pushed [registry] localhost:5000/test:push
ArtifactType: application/vnd.unknown.artifact.v1
Digest: sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79

@qweeah
Copy link
Contributor Author

qweeah commented Mar 27, 2024

A follow-up question, should we also display which type of content (layer, config, artifact, etc) has been uploaded in the output?

This is over designing. Also CLI don't have context of which type of content is during copying.

@qweeah
Copy link
Contributor Author

qweeah commented Mar 27, 2024

How about only show artifactType in the output when pushing an OCI v1.1 compliant artifact to the registry as follows:

  • Build and push an OCI v1.1 compliant artifact, artifactType showed in the output:
oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.1
✓ Uploaded  foo                                                                                               91/91  B 100.00%  163ms
  └─ sha256:ab8662bef009e2ec2c84621f9e1a6564188f32bcbbebc9463c09f3113c2a9994
✓ Uploaded  application/vnd.oci.empty.v1+json                                                          2/2  B 100.00%  166ms
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                                      666/666  B 100.00%     0s
  └─ sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79
Pushed [registry] localhost:5000/test:push
ArtifactType: application/vnd.unknown.artifact.v1
Digest: sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79

This looks good and echos with the ArtifactType field in the formatted JSON output:

output oras version
Version:        1.2.0-beta.1
Go version:     go1.21.6
Git commit:     9ffdb3eec60b969d842af1a9e699202e0827fa01
Git tree state: cleanoutput oras push localhost:5000/artifact:output image.tar --format json
✓ Exists    application/vnd.oci.empty.v1+json                                                      2/2  B 100.00%     0s
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Exists    image.tar                                                                              9/9  B 100.00%     0s
  └─ sha256:8b138a688d47b23d7cc0436b95807a3f74468e8f9ed81974acc0b1b18aa6eb52
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                         587/587  B 100.00%   23ms
  └─ sha256:ff2d22f6d636cec8d11fd1a5ae15606e43989006f479ce7bf3dc78fc26e733f7
{
  "Ref": "localhost:5000/artifact@sha256:ff2d22f6d636cec8d11fd1a5ae15606e43989006f479ce7bf3dc78fc26e733f7",
  "MediaType": "application/vnd.oci.image.manifest.v1+json",
  "Digest": "sha256:ff2d22f6d636cec8d11fd1a5ae15606e43989006f479ce7bf3dc78fc26e733f7",
  "Size": 587,
  "Annotations": {
    "org.opencontainers.image.created": "2024-03-27T02:12:30Z"
  },
  "ArtifactType": "application/vnd.unknown.artifact.v1"
}

@qweeah
Copy link
Contributor Author

qweeah commented Mar 27, 2024

  • Build and push an OCI v1.0 compliant artifact, no artifactType showed in the output:
oras push localhost:5000/test:push foo -v --disable-path-validation --image-spec v1.0
✓ Uploaded  foo                                                                                               91/91  B 100.00%  163ms
  └─ sha256:ab8662bef009e2ec2c84621f9e1a6564188f32bcbbebc9463c09f3113c2a9994
✓ Uploaded  application/vnd.unknown.config.v1+json                                                              2/2  B 100.00%  166ms
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                                      666/666  B 100.00%     0s
  └─ sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79
Pushed [registry] localhost:5000/test:push
Digest: sha256:5c901fd0002285d0c97efc98cfdfb1c85cc78ef93dbc45c50504462178e89a79

We still need to output the artifact type for v1.0 artifact since --format json will output artifact type

oras push localhost:5000/artifact:output image.tar --format json --image-spec v1.0
✓ Exists    image.tar                                                                              9/9  B 100.00%     0s
  └─ sha256:8b138a688d47b23d7cc0436b95807a3f74468e8f9ed81974acc0b1b18aa6eb52
✓ Exists    application/vnd.unknown.config.v1+json                                                 2/2  B 100.00%     0s
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                         525/525  B 100.00%     0s
  └─ sha256:ea9bd15737d671d50ed929983a73b67524464e4d96481c6d5f9c2bc261a212f3
{
  "Ref": "localhost:5000/artifact@sha256:ea9bd15737d671d50ed929983a73b67524464e4d96481c6d5f9c2bc261a212f3",
  "MediaType": "application/vnd.oci.image.manifest.v1+json",
  "Digest": "sha256:ea9bd15737d671d50ed929983a73b67524464e4d96481c6d5f9c2bc261a212f3",
  "Size": 525,
  "Annotations": {
    "org.opencontainers.image.created": "2024-03-27T02:13:42Z"
  },
  "ArtifactType": "application/vnd.unknown.config.v1+json"
}

Or we need to remove the ArtifactType from JSON output.

@qweeah
Copy link
Contributor Author

qweeah commented Mar 27, 2024

Also, what if config data is provided and ArtifactType is not presented in the packed descriptor?

$ oras push localhost:5000/artifact:output image.tar --format json --config <(echo -n {}):my/config
✓ Exists    my/config                                                                              0/0  B 100.00%     0s
  └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Exists    image.tar                                                                              9/9  B 100.00%     0s
  └─ sha256:8b138a688d47b23d7cc0436b95807a3f74468e8f9ed81974acc0b1b18aa6eb52
✓ Uploaded  application/vnd.oci.image.manifest.v1+json                                         496/496  B 100.00%   51ms
  └─ sha256:319a41145c336132ab399512081ba7e76bb95dde261bfb399839ee2b3129b9cb
{
  "Ref": "localhost:5000/artifact@sha256:319a41145c336132ab399512081ba7e76bb95dde261bfb399839ee2b3129b9cb",
  "MediaType": "application/vnd.oci.image.manifest.v1+json",
  "Digest": "sha256:319a41145c336132ab399512081ba7e76bb95dde261bfb399839ee2b3129b9cb",
  "Size": 496,
  "Annotations": {
    "org.opencontainers.image.created": "2024-03-27T02:29:20Z"
  },
  "ArtifactType": ""
}

Should we keep this empty ArtifactType or remove it if it's not presented?

@sajayantony
Copy link
Contributor

sajayantony commented Mar 27, 2024

I'm leaning towards omit if empty. Given that the spec is already in 1.1 and we want to focus on the 1.1 behavior going forward it would be good to just focus on ArtifactType and not auto promote configMediaType to artifactType. If we want to we could show the ConfigMediaType as well. But I don't think its that useful post 1.1 but for legacy artifact it will be.
So if we wanted to it would better as another field(which I'm still not sure is necessary)

@wangxiaoxuan273
Copy link
Contributor

wangxiaoxuan273 commented Apr 8, 2024

(This comment is outdated and current implementation does not have the auto option for --image-spec)

Current implementation and behaviors:

Display:
Show ArtifactType in metadata output during oras push, with both --image-spec v1.0 and v1.1. This is done in #1320
image

spec and artifact type behaviors
This is addressed in #1317

#1317 introduces auto option for --image-spec flag, and auto is made the default value. The auto option makes the spec v1.1, unless --config is used and --artifact-type is not given.

The spec versions used and the values of ArtifactType are displayed in the following table:
image

Note that there are three highlighted special cases:

  1. Given --image-spec auto, --config is used and --artifact-type not used, set the image spec version to v1.0, as this behavior is more compliant to the OCI guidance. The ArtifactType field during oras push will output the config media type.
  2. Given --image-spec v1.0, using both --config and --artifact-type flags is forbidden, as the given artifact type value conflicts with the config media type value.
  3. Given --image-spec v1.1, using --config without the --artifact-type flag is forbidden, as per the OCI guidance, v1.1 artifact has to have artifact type.

@FeynmanZhou @qweeah

@FeynmanZhou
Copy link
Member

FeynmanZhou commented Apr 9, 2024

After revisiting the design, --image-spec auto seems a bit complicated and redundant to users. In fact, the behavior of oras push without --image-spec is equal to with --image-spec v1.1 unless only --config is used. The reason is that the config.mediaType was used to indicate the type of the artifact (i.e. ArtifactType) in OCI Spec v1.0.

I had a discussion with @wangxiaoxuan273 @qweeah , we should be able to remove auto from --image-spec and explicitly mark the default behavior of oras push be compliant with OCI Spec v1.1 except when --config is used.

Simply speaking, the conclusion will be:

  • There are still only two options v1.0 and v1.1 in --image-spec for oras push.
  • The default output of ArtifactType inoras push is the same as --image-spec v1.1 except when --config is used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested spec required Issues that require specifications
Projects
None yet
6 participants