-
-
Notifications
You must be signed in to change notification settings - Fork 13
mz334: move resolveCrossStageCommands forwards #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
note that this temporarily makes the whole Well no, currently you can workaround that issue by not taking any optimizations, ie. |
c4959c5 to
21a4da2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the handling of cross-stage command resolution by moving the transformation of named stage references to numeric indices earlier in the build process. Instead of resolving COPY --from=<stage_name> to COPY --from=<index> later during ResolveCrossStageInstructions, this transformation now happens immediately when KanikoStage objects are created in MakeKanikoStages.
Key changes:
- Cross-stage command resolution moved from
ResolveCrossStageInstructionstoMakeKanikoStages - Simplified
fetchExtraStagesto only handle numeric stage references and remote images - Updated
skipUnusedStagesto remove named reference handling logic
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/executor/build.go | Removed named stage tracking in fetchExtraStages and call to ResolveCrossStageCommands in ResolveCrossStageInstructions |
| pkg/dockerfile/dockerfile.go | Made ResolveCrossStageCommands private, added stage name resolution in MakeKanikoStages, simplified skipUnusedStages |
| pkg/dockerfile/dockerfile_test.go | Updated tests to use MakeKanikoStages and set feature flag environment variable |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f287003 to
456a9cf
Compare
456a9cf to
ac9dd38
Compare
This is a refactoring in preparation for #334
Description
When we create KanikoStage's we replace all baseImage references with numeric references. But we keep both named and numeric references in
COPY --from. ieCOPY --from=baseorCOPY --from=0(yes this is valid syntax). Later we replace those references a bit hidden as part ofResolveCrossStageInstructions. With this change we just move that transformation to the beginning, so when you have a KanikoStage you are guaranteed to only have numeric references to other stages.Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Reviewer Notes
Release Notes
Describe any changes here so maintainer can include it in the release notes, or delete this block.