Add ESC to abort image pull with fall-back to local#341
Draft
gtsiolis wants to merge 1 commit into
Draft
Conversation
During a floating-tag pull, if a local copy of the image is already present and we're interactive, show "press esc to keep current version" once real layer download begins. Pressing ESC cancels only the in-flight pull (Ctrl+C still quits) and starts the emulator with the existing local image. A failed pull (e.g. offline) with a local copy present now falls back automatically instead of aborting the start. The domain stays UI-free: pullImage runs the pull under a per-pull cancel context and selects on a skip channel the TUI signals via the new PullSkippableEvent. Generated with [Linear](https://linear.app/localstack/issue/PRO-324/esc-to-abort-image-pull-with-fall-back-to-local#agent-session-ee6a32f4) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of a pre-pull prompt, pull immediately but let the user bail. When a floating-tag (
latest/empty) pull starts downloading real layers, a local copy of the image is present, and we're interactive, the spinner shows:Pressing ESC cancels only the in-flight pull (Ctrl+C still quits the program) and starts the emulator with the existing local image. The same fall-back happens automatically — regardless of interactive mode — when a pull fails (e.g. offline) and a local copy exists, rather than aborting the start. The hint only appears once Docker reports actual layer download, so it never flashes on a cache hit.
How it works
pullImagesnow checksImageExistsfor every image and delegates each pull to a newpullImagehelper that runs the pull under a per-pull cancel context andselects on a skip channel.PullSkippableEventcarrying a cancel channel it owns; the TUI binds ESC during the pulling phase to signal it. Non-interactive mode never emits the event, andPlainSinkhas no rendering for it.ErrorEvent+ silent error), preserving prior behavior.Tests
pullImage): ESC → skip + use local; pull error + local present → auto fall-back; pull error + no local → fatal; non-interactive → never skippable.app): ESC signals the skip channel and shows the hint without quitting; ESC is inert with no pull in flight.PlainSinksuppressesPullSkippableEvent.Deterministic integration tests aren't practical here — forcing an offline pull error requires intercepting the hardcoded registry, and an ESC-during-pull PTY test depends on pull timing — so the behavior is covered by the unit/UI tests above.
Depends on PRO-323 (
ImageExists), already merged.