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

refactor(progress): generic progress tracking #1524

Merged
merged 30 commits into from
Feb 19, 2025

Conversation

shizhMSFT
Copy link
Contributor

@shizhMSFT shizhMSFT commented Nov 1, 2024

This PR is an implementation of oras-project/oras-go#839. The goal is to refactor the core code of progress reporting from the oras CLI code base in order to put it into oras-go for others to implement their own progress reporting method. The refactored code is in the internal/progress package.

This PR refactors and unit tests the cmd/oras/internal/display/status/progress package.

This PR improves the UX with the changes below:

  • Add a red when error occurs
  • Add a padding to the second line of the progress view to fix the line overlapping issue
  • Improve performance

@shizhMSFT shizhMSFT added the experimental Issues or pull requests depending on WIP specs label Nov 1, 2024
Copy link

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale Inactive issues or pull requests label Dec 17, 2024
@shizhMSFT shizhMSFT removed the stale Inactive issues or pull requests label Dec 30, 2024
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

Attention: Patch coverage is 87.03072% with 38 lines in your changes missing coverage. Please review.

Project coverage is 84.27%. Comparing base (724f56b) to head (9b0a7a1).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/internal/display/status/track/target.go 51.61% 10 Missing and 5 partials ⚠️
...d/oras/internal/display/status/progress/manager.go 80.00% 5 Missing and 1 partial ⚠️
cmd/oras/root/blob/fetch.go 0.00% 4 Missing and 2 partials ⚠️
cmd/oras/root/blob/push.go 20.00% 2 Missing and 2 partials ⚠️
internal/progress/tracker.go 94.28% 3 Missing and 1 partial ⚠️
cmd/oras/internal/display/status/tty.go 90.62% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1524      +/-   ##
==========================================
- Coverage   84.33%   84.27%   -0.06%     
==========================================
  Files         120      121       +1     
  Lines        5464     5566     +102     
==========================================
+ Hits         4608     4691      +83     
- Misses        608      621      +13     
- Partials      248      254       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shizhMSFT shizhMSFT marked this pull request as ready for review December 31, 2024 09:51
@shizhMSFT
Copy link
Contributor Author

shizhMSFT commented Dec 31, 2024

Now we have a failure mark on error:
image

@shizhMSFT shizhMSFT changed the title refactor(oras-go): generic progress tracking refactor(progress): generic progress tracking Dec 31, 2024
Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built the code and tested a little bit. Got "panic: send on closed channel" error when running oras push localhost:5000/test:v1 foo.

@shizhMSFT
Copy link
Contributor Author

Got "panic: send on closed channel" error when running

A ha. This PR indeed requires further refactoring.

Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The panic problem is gone now. But it looks like the "Restored" keyword is not correctly showed.
image

@shizhMSFT
Copy link
Contributor Author

shizhMSFT commented Feb 17, 2025

The panic problem is gone now. But it looks like the "Restored" keyword is not correctly showed.

It's the skip. Thanks for catching it. And it is fixed.

@shizhMSFT shizhMSFT requested a review from Wwwsylvia February 18, 2025 12:59
@shizhMSFT shizhMSFT added this to the v1.3.0-beta.2 milestone Feb 18, 2025
@shizhMSFT shizhMSFT added enhancement New feature or request and removed experimental Issues or pull requests depending on WIP specs labels Feb 18, 2025
Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor suggestions.

Tracker.Update and some private methods in status.go can be further improved but it can be done in another PR.

Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT shizhMSFT merged commit a9004d4 into oras-project:main Feb 19, 2025
8 checks passed
@shizhMSFT shizhMSFT deleted the progress branch February 19, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants