oras-project / oras

OCI registry client - managing content like artifacts, images, packages
https://oras.land
Apache License 2.0
1.4k stars 171 forks source link

progress bar missing when copying artifact with zero-length layer from registry to OCI layout #1442

Open qweeah opened 1 month ago

qweeah commented 1 month ago

What happened in your environment?

Tried to copy a self-made artifact with multiple zero-length layers from registry to local OCI image layout but see a progress bar missing in the terminal output

> oras cp --to-oci-layout jinzha1.azurecr.io/test:blank-progress .
✓ Copied  application/vnd.docker.container.image.v1+json                                                              0/0  B 100.00%    9ms
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
⠋ [....................](   0  B/s) Copying application/vnd.docker.image.rootfs.diff.tar.gzip                      0.00/0  B   0.00%   26ms
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
✓ Copied  application/vnd.docker.distribution.manifest.v2+json                                                  6.16/6.16 kB 100.00%   19ms
  └─ sha256:47506275bd97c02cd5f2c8c86d67d1faf8d3816ba0278aae63fb9cd25ec02e6c
Copied [registry] jinzha1.azurecr.io/test:blank-progress => [oci-layout] .
Digest: sha256:47506275bd97c02cd5f2c8c86d67d1faf8d3816ba0278aae63fb9cd25ec02e6c

What did you expect to happen?

Should show copied for the application/vnd.docker.image.rootfs.diff.tar.gzip layer

How can we reproduce it?

Run oras cp --to-oci-layout jinzha1.azurecr.io/test:blank-progress .

What is the version of your ORAS CLI?

Version: 1.2.0 Go version: go1.22.3 Git commit: dcef719e208a9b226b15bc6512ad729a7dd93270 Git tree state: clean

What is your OS environment?

Window 11

Are you willing to submit PRs to fix it?

qweeah commented 1 month ago

Worth mentioning that this bug should exist in copy-specific code path, since mounting doesn't trigger this bug

> oras cp jinzha1.azurecr.io/sample-docker-image:from-sdk jinzha1.azurecr.io/bugs:blank-progress
✓ Mounted application/vnd.docker.image.rootfs.diff.tar.gzip                                                           0/0  B 100.00%     0s
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
✓ Mounted application/vnd.docker.container.image.v1+json                                                              0/0  B 100.00%     0s
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
✓ Copied  application/vnd.docker.distribution.manifest.v2+json                                                  6.16/6.16 kB 100.00%  856ms
  └─ sha256:47506275bd97c02cd5f2c8c86d67d1faf8d3816ba0278aae63fb9cd25ec02e6c
Copied [registry] jinzha1.azurecr.io/sample-docker-image:from-sdk => [registry] jinzha1.azurecr.io/bugs:blank-progress
Digest: sha256:47506275bd97c02cd5f2c8c86d67d1faf8d3816ba0278aae63fb9cd25ec02e6c