Skip to content

Conversation

AustinAbro321
Copy link
Contributor

@AustinAbro321 AustinAbro321 commented Jun 10, 2025

Description

This introduces occasional log statements to give progress during OCI pulls and pushes (images and Zarf packages).

Implementation was loosely inspired by the progressbar implementation in the ORAS CLI. Goal was to create simple a simple solution that avoids leaving users without feedback from the system for more than five seconds. UX was designed to be similar to how opentofu gives occasional progress feedback when something takes a while.

Views:
image pull on create:
image
image push on deploy (lowered interval for screenshot because local pushes are fast):
image
package pull:
image
package publish:
image

Related Issue

Fixes #3633

Checklist before merging

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Copy link

netlify bot commented Jun 10, 2025

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 6246030
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/685acaf0b92c42000837e7cb

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

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

Files with missing lines Patch % Lines
src/internal/packager/images/pull.go 60.46% 11 Missing and 6 partials ⚠️
src/internal/packager/images/progress.go 86.76% 7 Missing and 2 partials ⚠️
src/pkg/zoci/pull.go 0.00% 7 Missing ⚠️
src/internal/packager/images/push.go 70.58% 4 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/pkg/zoci/push.go 69.79% <100.00%> (+2.37%) ⬆️
src/internal/packager/images/push.go 52.84% <70.58%> (+1.62%) ⬆️
src/pkg/zoci/pull.go 57.05% <0.00%> (-2.19%) ⬇️
src/internal/packager/images/progress.go 86.76% <86.76%> (ø)
src/internal/packager/images/pull.go 53.16% <60.46%> (+0.40%) ⬆️

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@AustinAbro321 AustinAbro321 marked this pull request as ready for review June 18, 2025 12:21
@AustinAbro321 AustinAbro321 requested review from a team as code owners June 18, 2025 12:21
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's easier to review this with whitespace hidden

Copy link
Member

@brandtkeller brandtkeller left a comment

Choose a reason for hiding this comment

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

I love improvements that hits the UX. Minor items that come to mind - also believe some of this could be potentially unit tested in some capacity?

const defaultProgressInterval = 5 * time.Second

// StartReporting starts the reporting goroutine
func (tt *TrackedTarget) StartReporting() {
Copy link
Member

Choose a reason for hiding this comment

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

Given that the push is governed by the caller-supplied context - I wonder if this should accept context and if we could remove more of the bespoke stopReports in favor of a ctx.Done()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it should definitely accept a context. Though to get rid of the StopReporting call we'd have to make a separate context for StartReporting then cancel it. I like the feel of the defer StopReporting slightly more, but I don't feel too strongly either way

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
@AustinAbro321
Copy link
Contributor Author

@brandtkeller Separated out the Tracker object and created a unit test for it. I wanted to avoid creating a registry or mocking an oras.target for the test. I feel it's a reasonable test, but a bit jank. There might be way to better structure the code for easier unit tests, open to alternative ideas.

)

// newTestTracker creates a Tracker instance with a customizable report interval for testing.
func newTestTracker(bytesRead, totalBytes int64, reporter Report, interval time.Duration) *Tracker {
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Copy link
Member

@brandtkeller brandtkeller left a comment

Choose a reason for hiding this comment

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

Ran some tests locally - stepped through a few examples. We can let actual utility drive feedback for any additional guard rails that could exist.

LGTM

@AustinAbro321 AustinAbro321 added this pull request to the merge queue Jul 2, 2025
Merged via the queue into main with commit 44287a1 Jul 2, 2025
27 checks passed
@AustinAbro321 AustinAbro321 deleted the track-progress-oras branch July 2, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Give occasional progress updates during image pull and pushes
3 participants