Fix restorer to use selected mirror for Platform API 0.14#1606
Merged
Fix restorer to use selected mirror for Platform API 0.14#1606
Conversation
95f3b8b to
f8ef0bc
Compare
For Platform API 0.14+, the restorer should validate the already-selected run image from analyzed.toml without retrying the primary image first. This fixes issue #1590 where the restorer's runImageAccessCheck would call BestRunImageMirrorFor with the full entry (primary + mirrors), causing it to attempt accessing the inaccessible primary image before trying the already-selected mirror. Changes: - Add ResolveRunImageFromAnalyzed function to validate selected mirror - Update restorer to use new function for Platform API 0.14+ - Add comprehensive tests covering the fix and edge cases - Improve error messages to include image name for better debugging Fixes #1590 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
f8ef0bc to
14bd5aa
Compare
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
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