build: automatically set correct $TARGETPLATFORM where expected.#3899
Conversation
9935651 to
b6d93da
Compare
|
LGTM, once a new IB is built and vendored. I've thrown a WIP tag on this for now. |
b6d93da to
ef9a9fd
Compare
|
Since this is merged openshift/imagebuilder#224 , pointing to latest imagebuilder and marking this PR ready for review. |
|
The imagebuilder logic also predefines TARGETOS, TARGETARCH, and TARGETVARIANT args. Are those already correct, or do they likewise need to be fixed up at the same time? |
ef9a9fd to
50249ef
Compare
|
@nalind yes we were also not setting |
50249ef to
23f9c28
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
69c7e6e to
67ae077
Compare
Automatically set correct value of TARGETPLATFORM if one or more `--platform` are selected for the build. This ensures that behaviour of buildah is equivalent to `buildkit` for the args `$BUILDPLATFORM` and `$TARGETPLATFORM`, `$TARGETOS`, `$TARGETARCH` and `$TARGETVARIANT` Where $BUILDPLATFORM is set always native to host and $TARGETPLATFORM is foreign selected via `--platform`. Example ```console $ buildah build --platform linux/arm64 . ``` ```Dockerfile FROM --platform=$BUILDPLATFORM alpine ARG TARGETPLATFORM ARG BUILDPLATFORM RUN echo "I'm compiling for $TARGETPLATFORM on $BUILDPLATFORM" ``` Signed-off-by: Aditya R <arajan@redhat.com>
Use imagebuilder which sets correct behaviour for default builtinargs while processing inline `FROM --platform=` after openshift/imagebuilder#224 Signed-off-by: Aditya R <arajan@redhat.com>
Following test verifies the behaviour of inline `--platform` with `FROM` statement and usage of builtinargs with it, specifically the behaviour of `$TARGETPLATFORM` and `$BUILDPLATFORM` Signed-off-by: Aditya R <arajan@redhat.com>
67ae077 to
01b65b3
Compare
|
@rhatdan PTAL updated comments as requested. |
|
/lgtm |
|
/hold cancel |
|
This breaks podman: SEGV in bud-multiple-something (also remote). Stack trace, so it should be easy to identify and fix. |
|
@edsantiago Checking. |
|
Thank you. From my untrained glance it makes no sense, I see nothing in these diffs that could cause it; but I ran the treadmill on the previous commit and everything passed, so this is the likely first place to look. UPDATE: reproduces easily under buildah itself, so it's not a podman-vendoring thing |
Automatically set correct value of TARGETPLATFORM if one or more
--platformare selected for the build. This ensures that behaviourof buildah is equivalent to
buildkitfor the args$BUILDPLATFORMand$TARGETPLATFORM.Where
$BUILDPLATFORMis set always native to host and$TARGETPLATFORMis foreign selected os/arch via
--platform.Example
$ buildah build --platform linux/arm64 .$BUILDPLATFORMand$TARGETPLATFORMfor cases using inlineFROM --platform=Wait for: openshift/imagebuilder#224
See also: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images