Skip to content
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

feat: support pre-defined build args of multi-platform build arguments #3392

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kit101
Copy link

@kit101 kit101 commented Jan 22, 2025

…ents

Fixes # in case of a bug fix, this should point to a bug and any other related issue(s)

Description

Support pre-defined build arguments, similarly to docker Pre-defined build arguments / Multi-platform build arguments

/workspace # cat Dockerfile
FROM alpine:3

ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH

RUN echo $BUILDPLATFORM, $BUILDOS $BUILDARCH

RUN echo $TARGETPLATFORM, $TARGETOS $TARGETARCH $TARGETVARIANT

COPY release/$TARGETOS/$TARGETARCH/bin /usr/local/bin/bin

/workspace # executor --no-push -d docker.io/library/example --custom-platform linux/arm/v6
INFO[0000] Retrieving image manifest alpine:3
INFO[0000] Retrieving image alpine:3 from registry index.docker.io
INFO[0003] Built cross stage deps: map[]
INFO[0003] Retrieving image manifest alpine:3
INFO[0003] Returning cached image manifest
INFO[0003] Executing 0 build triggers
INFO[0003] Building stage 'alpine:3' [idx: '0', base-idx: '-1']
INFO[0003] Unpacking rootfs as cmd RUN echo $BUILDPLATFORM, $BUILDOS $BUILDARCH requires it.
INFO[0003] ARG TARGETPLATFORM
INFO[0003] ARG TARGETOS
INFO[0003] ARG TARGETARCH
INFO[0003] ARG TARGETVARIANT
INFO[0003] ARG BUILDPLATFORM
INFO[0003] ARG BUILDOS
INFO[0003] ARG BUILDARCH
INFO[0003] RUN echo $BUILDPLATFORM, $BUILDOS $BUILDARCH
INFO[0003] Initializing snapshotter ...
INFO[0003] Taking snapshot of full filesystem...
INFO[0003] Cmd: /bin/sh
INFO[0003] Args: [-c echo $BUILDPLATFORM, $BUILDOS $BUILDARCH]
INFO[0003] Running: [/bin/sh -c echo $BUILDPLATFORM, $BUILDOS $BUILDARCH]
linux/amd64, linux amd64
INFO[0003] Taking snapshot of full filesystem...
INFO[0003] No files were changed, appending empty layer to config. No layer added to image.
INFO[0003] RUN echo $TARGETPLATFORM, $TARGETOS $TARGETARCH $TARGETVARIANT
INFO[0003] Cmd: /bin/sh
INFO[0003] Args: [-c echo $TARGETPLATFORM, $TARGETOS $TARGETARCH $TARGETVARIANT]
INFO[0003] Running: [/bin/sh -c echo $TARGETPLATFORM, $TARGETOS $TARGETARCH $TARGETVARIANT]
linux/arm/v6, linux arm v6
INFO[0003] Taking snapshot of full filesystem...
INFO[0003] No files were changed, appending empty layer to config. No layer added to image.
INFO[0003] COPY release/$TARGETOS/$TARGETARCH/bin /usr/local/bin/bin
INFO[0003] Taking snapshot of files...
INFO[0003] Skipping push to container registry due to --no-push flag

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

Copy link

google-cla bot commented Jan 22, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kit101
Copy link
Author

kit101 commented Jan 22, 2025

@aaron-prindle
please review code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant