Skip to content

refactor(progress): generic progress tracking#1524

Merged
shizhMSFT merged 30 commits into
oras-project:mainfrom
shizhMSFT:progress
Feb 19, 2025
Merged

refactor(progress): generic progress tracking#1524
shizhMSFT merged 30 commits into
oras-project:mainfrom
shizhMSFT:progress

Conversation

@shizhMSFT

@shizhMSFT shizhMSFT commented Nov 1, 2024

Copy link
Copy Markdown
Contributor

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
@github-actions

Copy link
Copy Markdown

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
@codecov

codecov Bot commented Dec 30, 2024

Copy link
Copy Markdown

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

shizhMSFT commented Dec 31, 2024

Copy link
Copy Markdown
Contributor Author

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

@Wwwsylvia Wwwsylvia left a comment

Copy link
Copy Markdown
Member

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.

Comment thread cmd/oras/internal/display/status/tty.go Outdated
@shizhMSFT

Copy link
Copy Markdown
Contributor Author

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

A ha. This PR indeed requires further refactoring.

@Wwwsylvia Wwwsylvia left a comment

Copy link
Copy Markdown
Member

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

shizhMSFT commented Feb 17, 2025

Copy link
Copy Markdown
Contributor Author

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

@qweeah qweeah left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread cmd/oras/internal/display/status/progress/messenger.go Outdated
Comment thread internal/testutils/prompt.go Outdated
Comment thread internal/testutils/prompt.go Outdated
Comment thread internal/progress/tracker.go
Comment thread cmd/oras/internal/display/status/progress/messenger.go Outdated
Comment thread cmd/oras/internal/display/status/progress/messenger.go Outdated
Comment thread cmd/oras/internal/display/status/progress/messenger.go Outdated
Comment thread cmd/oras/internal/display/status/progress/messenger.go Outdated
Comment thread internal/progress/tracker.go
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>

@qweeah qweeah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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