[deckhouse-cli] Fix extra images dropped on network errors#418
Draft
Glitchy-Sheep wants to merge 6 commits into
Draft
[deckhouse-cli] Fix extra images dropped on network errors#418Glitchy-Sheep wants to merge 6 commits into
Glitchy-Sheep wants to merge 6 commits into
Conversation
- `errExtraImagesJSONNotFound` lets callers tell an absent `extra_images.json` from a network read error via `errors.Is`. - Groundwork so the discovery step can retry transient failures instead of skipping the module version. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `getExtraImagesJSON` retries transient registry errors when reading a module version's extra_images.json. - A missing image or missing extra_images.json returns (nil, nil): a version without extra images is expected, not a failure. - A persistent error is returned so the caller can fail the pull instead of quietly dropping extra images. - Retries are logged via `userLogger.Warnf`, visible without debug. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `findExtraImages` reads each version through `getExtraImagesJSON`, so a transient registry error is retried instead of dropping the version's extra images. - A persistent error propagates through `pullExtraImages` and fails the pull, rather than getting swallowed at debug level while the bundle ends up missing extra images. - A version with no extra_images.json is still skipped cleanly. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- Cover `findExtraImages`: extra_images.json is parsed into extra image refs, and a version without it or with a missing image is skipped. - A transient GetImage error is retried and the extra images still land once the registry recovers. - A persistent error fails discovery instead of silently dropping the version's extra images. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `mutate.Extract` masks a failed mid-layer read as a clean io.EOF, so a network error looked identical to extra_images.json being absent. - The version's extra images were then dropped silently, which the earlier retry/fail-loud handling never got a chance to catch. - Scanning the image layers directly surfaces a truncated read as a real error. - The caller retries that error and fails the pull when it persists, instead of skipping the version. - `errExtraImagesJSONNotFound` is returned only when a layer is read in full without the file present. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- Cover extractExtraImagesJSON directly: a layer read that aborts mid-stream returns a real error, not errExtraImagesJSONNotFound. - This pins the fix for the masked-EOF bug so it can't silently regress. - Keep the happy path and the genuinely-absent case: a present file is parsed, a fully-read layer without the file is a clean not-found. Signed-off-by: Roman Berezkin <roman.berezkin@flant.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.
Summary
During module pull, extra images are discovered by reading
extra_images.jsonfrom each version image. A network error while reading it was treated the same as "this version has no extra images", so the images were dropped and the pull still reported success.Problem
findExtraImagesswallowed every error fromGetImageand from readingextra_images.json.Fix
extra_images.jsonthrough the sharedretry.RunTaskprimitive (5 attempts, 10s apart) - the same retry the image-pull step already uses.extra_images.jsonis a clean skip.findExtraImagesnow returns an error andpullExtraImagespropagates it up.Before / After
Before: a network error during extra images discovery dropped that version's extra images, and the pull still finished successfully.
After: the read is retried; if it keeps failing, the pull stops with a clear error instead of producing an incomplete bundle.
Tests
TestFindExtraImages_Discovery- a version withextra_images.jsonyields its extra images; a version without it, or with a missing image, is skipped.TestFindExtraImages_RetriesTransientError- a transient GetImage error is retried and the extra images still land.TestFindExtraImages_FailsOnPersistentError- a persistent error returns an error instead of an empty result.Notes
extractInternalDigestImages,extractVersionsFromReleaseChannels, andpackages/packages.gofindExtraImages. Left out on purpose: their pull step is best-effort.