You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Platform API 0.14 with the -run flag, the restorer fails to pull the run image because it attempts to access the primary (inaccessible) run image instead of using the mirror that was already selected by the analyzer.
Reproduction
Steps
Set up a builder with an intentionally inaccessible primary run image and an accessible mirror:
[[run.images]]
image = "pack-test/run"# Intentionally inaccessible (401 from Docker Hub)mirrors = ["localhost:5000/pack-test/run"] # Accessible local registry
Build an application using Platform API 0.14+ with image extensions that extend the run image:
Observe that the restorer receives the -run flag with run.toml containing both primary and mirrors
The restorer fails with:
[restorer] Pulling run image metadata for pack-test/run...
[restorer] ERROR: failed to pull run image pack-test/run: failed to get remote image
Current Behavior
The restorer's runImageAccessCheck method (cmd/lifecycle/restorer.go:206-221) calls FindByRef() with the selected mirror, which returns the full entry including the primary image. Then BestRunImageMirrorFor() attempts to validate the primary image first (platform/run_image.go:89-90), which fails with authentication errors, and never tries the mirrors.
Test case: The acceptance test at pack's acceptance/acceptance_test.go:1228-1253 consistently reproduces this issue
Intentional test setup: The pack-test/run image is intentionally inaccessible to validate mirror selection functionality
Scope: This bug only affects the "extending" scenario where extensions modify the run image, not the "switching" scenario
The analyzer correctly handles mirror selection, but the restorer's re-validation logic doesn't respect that selection when authentication fails on the primary image.
Summary
When using Platform API 0.14 with the
-runflag, the restorer fails to pull the run image because it attempts to access the primary (inaccessible) run image instead of using the mirror that was already selected by the analyzer.Reproduction
Steps
Set up a builder with an intentionally inaccessible primary run image and an accessible mirror:
Build an application using Platform API 0.14+ with image extensions that extend the run image:
Observe that the analyzer correctly selects the accessible mirror and writes it to
analyzed.toml:Observe that the restorer receives the
-runflag withrun.tomlcontaining both primary and mirrorsThe restorer fails with:
Current Behavior
The restorer's
runImageAccessCheckmethod (cmd/lifecycle/restorer.go:206-221) callsFindByRef()with the selected mirror, which returns the full entry including the primary image. ThenBestRunImageMirrorFor()attempts to validate the primary image first (platform/run_image.go:89-90), which fails with authentication errors, and never tries the mirrors.Relevant code:
Expected Behavior
The restorer should use the accessible mirror image that was selected by the analyzer, rather than failing when the primary image is inaccessible.
Context
Lifecycle Version
-runflag was introduced in v0.20.0Platform Version(s)
-runflag for run image extensionsAdditional Context
acceptance/acceptance_test.go:1228-1253consistently reproduces this issuepack-test/runimage is intentionally inaccessible to validate mirror selection functionalityThe analyzer correctly handles mirror selection, but the restorer's re-validation logic doesn't respect that selection when authentication fails on the primary image.