Fix restorer to use selected mirror for Platform API 0.14 #1606
+149
−5
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
Fixes #1590
For Platform API 0.14+, the restorer now validates the already-selected run image from
analyzed.tomlwithout retrying the primary image first.Problem
When using Platform API 0.14 with the
-runflag, the restorer'srunImageAccessCheckmethod would:analyzed.toml(e.g.,localhost:5000/pack-test/run- a mirror)runToml.FindByRef()which returns the full entry including primary + mirrorsBestRunImageMirrorFor()which tries the primary image firstThis violated the Platform API 0.14 spec which states the restorer should "resolve mirrors for the run-image in analyzed.toml" - meaning validate the already-selected image, not redo selection.
Solution
Added
ResolveRunImageFromAnalyzed()function inplatform/run_image.gothat:analyzed.tomlUpdated
runImageAccessCheck()incmd/lifecycle/restorer.goto use the new function for Platform API 0.14+Added comprehensive tests covering:
Testing
Test Plan
The acceptance test in buildpacks/pack#2516 (
acceptance/acceptance_test.go:1228-1253) should now pass with this fix.🤖 Generated with Claude Code