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

ORAS log is not matched with the result when pushing a file with multiple tags #1207

Open
1 task
FeynmanZhou opened this issue Dec 21, 2023 · 3 comments
Open
1 task
Labels
enhancement New feature or request logging question Further information is requested
Milestone

Comments

@FeynmanZhou
Copy link
Member

FeynmanZhou commented Dec 21, 2023

What happened in your environment?

I pushed a file hello.txt with 3 tags v11, v12, v13 as follows:

$ oras push localhost:5000/oras:v11,v12,v13 hello.txt
Exists    e3b0c44298fc hello.txt
Pushed [registry] localhost:5000/oras:v11
Tagged v12
Tagged v13
Digest: sha256:466a0ca65eff1b3602f5ef44cf6e32bac75976ccbdacf3d7c09218a5cd2db373

From the logs, it tells me the file has been pushed to only, but v12 and v13 are tagged.

Next, when I view the manifest of localhost:5000/oras:v12, the file hello.txt has also been pushed to this repo.

oras manifest fetch localhost:5000/oras:v12 --output - | jq
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.unknown.artifact.v1",
  "config": {
    "mediaType": "application/vnd.oci.empty.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2,
    "data": "e30="
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "size": 0,
      "annotations": {
        "org.opencontainers.image.title": "hello.txt"
      }
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2023-12-21T09:41:16Z"
  }
}

It looks a bit confusing because the file has also been pushed to v12 and v13, but the logs don't tell me this result explicitly.

What did you expect to happen?

$ oras push localhost:5000/oras:v11,v12,v13 hello.txt
Exists    e3b0c44298fc hello.txt
Tagged v11 and pushed the file to [registry] localhost:5000/oras:v11
Tagged v12 and pushed the file to [registry] localhost:5000/oras:v12
Tagged v13 and pushed the file to [registry] localhost:5000/oras:v13
Digest: sha256:466a0ca65eff1b3602f5ef44cf6e32bac75976ccbdacf3d7c09218a5cd2db373

or

$ oras push localhost:5000/oras:v11,v12,v13 hello.txt
Exists    e3b0c44298fc hello.txt
pushed the file to [registry] localhost:5000/oras:v11
pushed the file to [registry] localhost:5000/oras:v12
pushed the file to [registry] localhost:5000/oras:v13
Digest: sha256:466a0ca65eff1b3602f5ef44cf6e32bac75976ccbdacf3d7c09218a5cd2db373

How can we reproduce it?

Described in the first question

What is the version of your ORAS CLI?

v1.1.0

What is your OS environment?

Ubuntu

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.
@FeynmanZhou FeynmanZhou added bug Something isn't working triage New issues or PRs to be acknowledged by maintainers labels Dec 21, 2023
@qweeah qweeah removed the bug Something isn't working label Dec 22, 2023
@qweeah
Copy link
Contributor

qweeah commented Dec 22, 2023

oras push localhost:5000/oras:v11,v12,v13 hello.txt = oras push localhost:5000/oras:v11 hello.txt + orag tag localhost:5000/oras:v11, the Tagged xxx output is just to be consistent with oras tag logs.

@FeynmanZhou FeynmanZhou changed the title The logs is not matched with the result when pushing a file with multiple tags ORAS log is not matched with the result when pushing a file with multiple tags Dec 26, 2023
@yizha1 yizha1 added the enhancement New feature or request label Dec 26, 2023
@yizha1 yizha1 added this to the future milestone Dec 26, 2023
@yizha1 yizha1 removed the triage New issues or PRs to be acknowledged by maintainers label Dec 26, 2023
@FeynmanZhou FeynmanZhou modified the milestones: future, v1.3.0 Mar 4, 2024
@qweeah
Copy link
Contributor

qweeah commented Mar 21, 2024

BTW I just found such output is also applied in oras cp and oras manifest push

# copy
$ oras cp localhost:5000/command/artifacts:foobar localhost:5000/to:v1,v2,v3,v4
✓ Copied  application/vnd.oci.image.manifest.v1+json                                          851/851  B 100.00%   24ms
  └─ sha256:fd6ed2f36b5465244d5dc86cb4e7df0ab8a9d24adc57825099f522fe009a22bb
Copied [registry] localhost:5000/command/artifacts:foobar => [registry] localhost:5000/to:v1
Tagged v2
Tagged v4
Tagged v3
Digest: sha256:fd6ed2f36b5465244d5dc86cb4e7df0ab8a9d24adc57825099f522fe009a22bb

# push manifest
oras manifest fetch localhost:5000/to:v1 -o manifest.json
oras manifest push localhost:5000/to:v1,v2,v3 manifest.json
Pushed [registry] localhost:5000/to:v1
Tagged v2
Tagged v3
Digest: sha256:fd6ed2f36b5465244d5dc86cb4e7df0ab8a9d24adc57825099f522fe009a22bb

@shizhMSFT shizhMSFT added the question Further information is requested label Sep 3, 2024
@Wwwsylvia
Copy link
Member

@FeynmanZhou is this really needed? As @qweeah has mentioned, the current output is by design.
It is not appropriate to print something like

Tagged v11 and pushed the file to [registry] localhost:5000/oras:v11
Tagged v12 and pushed the file to [registry] localhost:5000/oras:v12
Tagged v13 and pushed the file to [registry] localhost:5000/oras:v13

, because of the following reasons:

  1. The file is pushed as a layer, not a manifest, and it can't be represented by a tag such as v11
  2. If the push target is an OCI layout, what ORAS does behind the scenes is pushing the manifest first and tagging them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request logging question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants