-
Notifications
You must be signed in to change notification settings - Fork 74
dispatcher: Parse --platform via FROM --platform= and assign to field in stage's Builder
#212
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
dispatcher: Parse --platform via FROM --platform= and assign to field in stage's Builder
#212
Conversation
|
@nalind PTAL. This is the approach which i am thinking about. Following approach delegates whole Also platform string is unqiue for stages so each stage can have its own platform example FROM --platform=linux/amd64 alpine
RUN uname -m
FROM --platform=linux/arm64 alpine
RUN uname -m |
|
@flouthoc, does Docker allow for different platforms per FROM statement? The documentation you provided wasn't clear about that. |
|
Would be good to have some tests added. I think, but I'm not sure that this handles an "AS" clause. Have you confirmed? |
@TomSweeneyRedHat Yes I tried it last time with buildkit it supports that but only makes lot of sense when user has a But irrespective of the even legacy docker build supports
Yes |
|
How complete is this intended to be? This needs to update the various |
|
@nalind hmm i'm still thinking if we should override the variables I'll check with buildkit once if they are doing it then we can do the same ? But |
|
@nalind I think FROM --platform=linux/arm64 alpine
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"still shows Command --platform can use |
Apparently |
@nalind Cool then i guess just instrumenting docker-client is enough right, i'll also add a test. |
d498d9b to
92bd705
Compare
|
/assign @nalind |
92bd705 to
2159e4b
Compare
nalind
left a 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.
A couple of formatting nits, otherwise LGTM.
builder.go
Outdated
|
|
||
| Warnings []string | ||
| // Raw platform string specified with `FROM --platform` of the stage | ||
| // Its upto the implementation or client to parse and use this field |
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.
Nit: typo "upto"
dispatchers_test.go
Outdated
| if mybuilder.Platform != expectedPlatform { | ||
| t.Errorf("Expected %v, to match %v\n", expectedPlatform, mybuilder.Platform) | ||
| } | ||
|
|
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.
Nit: extra blank line
…builder Allows imagebuilder to read and `--platform` if specified in `FROM` and relay it to implementations using `stage.Builder.Platform` Signed-off-by: Aditya R <[email protected]>
Add support to dockerclient to actually use platform while pulling image if specified in `FROM --platform=<>` before this commit platform was `no-op` for image pulls. Signed-off-by: Aditya R <[email protected]>
2159e4b to
d77c933
Compare
|
@flouthoc: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
/approve |
|
[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 |
Allows imagebuilder to read
--platformif specified inFROMandrelay it to implementations using
stage.Builder.Platformso implementation canactually use platform while pulling the image.
Example Demonstration/Implementation here: containers/buildah#3757
Reference: https://docs.docker.com/engine/reference/builder/#from