-
Notifications
You must be signed in to change notification settings - Fork 798
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
stage_executor: reset platform in systemcontext for every stage. #5971
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: flouthoc The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Just wondering how to test this in CI since |
Ephemeral COPR build failed. @containers/packit-build please check. |
d15172e
to
8cef977
Compare
Temp adding |
The "header-builtin" test does something similar, so I'd suggest ARG FOREIGNARCH
FROM --platform=linux/$FOREIGNARCH busybox AS foreign
FROM busybox
COPY --from=foreign /bin/busybox /bin/busybox.foreign
RUN arch
RUN ls -l /bin/busybox /bin/busybox.foreign
RUN ! cmp /bin/busybox /bin/busybox.foreign Define the |
cbc1002
to
4010772
Compare
// In a multi-stage build where `FROM --platform=<>` was used then we must | ||
// reset context for new stages so that new stages don't inherit unexpected | ||
// `--platform` from prior stages. | ||
if stage.Builder.Platform != "" || (stage.Position != 0 && builderSystemContext.ArchitectureChoice == "" && builderSystemContext.VariantChoice == "" && builderSystemContext.OSChoice == "") { |
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.
Would this be simpler if the builderSystemContext
had its ...Choice
fields cleared as part of initializing it?
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.
I don't think we can do that since in certain cases the fields are set beforehand for example when it's build with --platform
or --all-platforms
so clearing ...Choice
would reset values in such case.
if [[ "$otherarch" == "$myarch" ]]; then | ||
otherarch="amd64" | ||
fi | ||
run_buildah build $WITH_POLICY_JSON --build-arg FOREIGNARCH=$otherarch -f $BUDFILES/multiarch/Containerfile.reset-platform $BUDFILES/multiarch |
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.
This should also test a case where the the TARGETPLATFORM build-arg is set, so that we don't regress on that.
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.
I added a test which sets TARGETPLATFORM using --platform
, should that cover what you meant by this comment ?
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.
I mean literally setting --build-arg TARGETPLATFORM=
, which has been known to be done instead of using the --platform
flag. This had to be fixed before in #5731.
4010772
to
66b0cac
Compare
@nalind PTAL |
Every stage now has its own copy of systemcontext. On processing of every stage platform spec in systemcontext must be correctly reset. Closes: containers#5968 Signed-off-by: flouthoc <[email protected]>
66b0cac
to
f5d79f8
Compare
On processing of every stage platform spec in systemcontext must be correctly reset.
[NO NEW TESTS NEEDED]
Closes: #5968
What type of PR is this?
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?