feat: report push phase transitions during OCI image export#2797
feat: report push phase transitions during OCI image export#2797markphelps merged 8 commits intomainfrom
Conversation
During OCI push, the Docker image export phase (docker save → temp tarball) was completely silent — the user saw nothing while potentially large images were exported. This adds phase reporting through the existing PushProgress callback so the CLI can display status messages during the export. Rather than adding a separate callback, PushProgress is extended with a Phase field. Phase-only updates (Phase set, byte fields zero) signal transitions between exporting and pushing; byte-progress updates (Phase empty) report per-layer upload progress as before. This keeps a single callback contract for all push progress.
Phase transitions (exporting, pushing) now print via console.Infof for pretty CLI formatting, while per-layer progress bars continue using the JSON progress writer.
During OCI push, the Docker image export phase (docker save → temp tarball) was completely silent — the user saw nothing while potentially large images were exported. This adds phase reporting through the existing PushProgress callback so the CLI can display status messages during the export. Rather than adding a separate callback, PushProgress is extended with a Phase field. Phase-only updates (Phase set, byte fields zero) signal transitions between exporting and pushing; byte-progress updates (Phase empty) report per-layer upload progress as before. This keeps a single callback contract for all push progress.
Phase transitions (exporting, pushing) now print via console.Infof for pretty CLI formatting, while per-layer progress bars continue using the JSON progress writer.
d247f38 to
ee74d41
Compare
|
Review: The deferred cleanup calls in image_pusher.go (around line 136) are in the wrong order. defer executes LIFO, so the file is deleted before it is closed. Swap the order of the defer calls so tmpTar.Close() runs first, then os.Remove(). |
|
Review posted: #2797 (comment) The |
…icate/cog into mphelps/push-phase-progress * 'mphelps/push-phase-progress' of https://github.com/replicate/cog: (95 commits) feat: add metric name validation (#2911) Rename `cog run` to `cog exec` (#2916) chore(deps): bump github.com/google/go-containerregistry (#2884) fix: replace removed libgl1-mesa-glx in tensorflow integration test (#2914) ci: enforce stub freshness in CI, fix existing stub drift (#2912) feat: add schema-compare command to test harness (#2891) chore(deps): bump uuid from 1.22.0 to 1.23.0 in /crates (#2887) chore(deps): bump github.com/hashicorp/go-version from 1.7.0 to 1.9.0 (#2909) chore(deps): bump insta from 1.46.3 to 1.47.2 in /crates (#2908) fix: support list[X] | None inputs + integration tests for PEP 604 union File/Path coercion (#2882) ci: exclude Dependabot PRs from auto-code review (#2910) chore(deps): bump actions/checkout from 4 to 6 (#2904) chore(deps): bump github.com/testcontainers/testcontainers-go/modules/registry (#2886) fix: metrics bugs in coglet prediction server (#2896) Bump version to 0.17.2 (#2903) fix(coglet): propagate metric scope to async event loop thread (#2902) chore: remove unnecessary nolint directive in test (#2803) feat(coglet): add Sentry error reporting for infrastructure errors (#2865) fix: homebrew cask postflight xattr references wrong binary name (#2899) fix: include custom metrics in cog predict --json output (#2897) ...
Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
|
I'm Bonk, and I've done a quick review of your PR. Summary: Adds phase transition reporting ( Issue:
|
|
After careful review, I don't see any actionable issues. The defer order concern from the previous review was based on a misunderstanding - the code uses an anonymous function where statements execute in written order (Close → Remove), not LIFO. This is correct. The PR properly:
LGTM |
Summary
docker save→ temp tarball) was completely silent — the user saw nothing while potentially large images were exported to disk before chunked upload began.PushProgresswith aPhasefield so phase transitions (exporting → pushing) flow through the existing single callback, and the CLI displays status messages likeExporting image from Docker daemon...during the silent export phase.Design
Rather than adding a separate
PhaseFncallback andImagePhaseFnoption (which would double the callback surface),PushProgressnow carries two kinds of updates through one channel:PhaseLayerDigest/ byte fields"exporting")The CLI dispatches on
prog.Phase != ""to show status-only lines vs progress bars — both rendered through the existingProgressWriter.Changes
pkg/model/push_helpers.go— AddedPushPhasetype withPushPhaseExportingandPushPhasePushingconstants; extendedPushProgresswithPhasefieldpkg/model/image_pusher.go— Emit phase callbacks via existingprogressFnat export start and push startpkg/model/pusher.go— UpdatedPushOptions.ImageProgressFndocs to reflect unified contractpkg/cli/push.go— Handle phase updates in the progress callback, showing status lines during exportpkg/model/image_pusher_test.go— Updated test to verify both phase transitions and byte progress