oras-project / oras

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

fix(cp): avoid showing empty descriptor in progress bar #1528

Closed qweeah closed 3 weeks ago

qweeah commented 3 weeks ago

What this PR does / why we need it: This PR fixes progress ratio and missing descriptor in the progress output.

Before

> 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

After

> oras cp --to-oci-layout jinzha1.azurecr.io/test:blank-progress ./debug
✓ Copied  application/vnd.docker.image.rootfs.diff.tar.gzip                                                                                                0/0  B 100.00%    1ms
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
✓ Copied  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%  808µs
  └─ sha256:47506275bd97c02cd5f2c8c86d67d1faf8d3816ba0278aae63fb9cd25ec02e6c
Copied [registry] jinzha1.azurecr.io/test:blank-progress => [oci-layout] ./debug
Digest: sha256:47506275bd97c02cd5f2c8c86d67d1faf8d3816ba0278aae63fb9cd25ec02e6c

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #1442

Please check the following list:

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.99%. Comparing base (b8db531) to head (793acd1). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1528 +/- ## ========================================== + Coverage 83.87% 83.99% +0.12% ========================================== Files 118 118 Lines 5166 5174 +8 ========================================== + Hits 4333 4346 +13 + Misses 592 588 -4 + Partials 241 240 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.