Skip to content

Show artifact type when pushing files #1061

Description

@qweeah

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.

Activity

  1. added
    enhancement
    on Aug 10, 2023
  2. added this to the future milestone on Aug 10, 2023
  3. FeynmanZhou commented on Aug 10, 2023

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

  4. qweeah commented on Aug 10, 2023

    @qweeah
    ContributorAuthor

    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.

  5. modified the milestones: future, v1.2.0 on Aug 18, 2023
  6. added
    question
    on Oct 17, 2023
  7. modified the milestones: v1.2.0, v1.3.0 on Jan 23, 2024
  8. wangxiaoxuan273 commented on Mar 15, 2024

    @wangxiaoxuan273
    Contributor

    I'd like to work on this

  9. added
    spec required
    on Mar 19, 2024
  10. FeynmanZhou commented on Mar 26, 2024

    @FeynmanZhou
    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
    
  11. FeynmanZhou commented on Mar 26, 2024

    @FeynmanZhou
    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
    
  12. qweeah commented on Mar 27, 2024

    @qweeah
    ContributorAuthor

    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.

  13. qweeah commented on Mar 27, 2024

    @qweeah
    ContributorAuthor

    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: clean
    ➜  output 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"
    }
  14. qweeah commented on Mar 27, 2024

    @qweeah
    ContributorAuthor
    • 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.

  15. qweeah commented on Mar 27, 2024

    @qweeah
    ContributorAuthor

    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?

  16. sajayantony commented on Mar 27, 2024

    @sajayantony
    Contributor

    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)

  17. modified the milestones: v1.3.0, v1.2.0 on Apr 8, 2024
  18. wangxiaoxuan273 commented on Apr 8, 2024

    @wangxiaoxuan273
    Contributor

    (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

  19. FeynmanZhou commented on Apr 9, 2024

    @FeynmanZhou
    Member

    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

Metadata

Metadata

Labels

enhancementquestionspec required

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions