kubernetes-csi / csi-release-tools

shared build and test files used by kubernetes-csi projects
Apache License 2.0
22 stars 73 forks source link

add build-arg ARCH #134

Closed andyzhangx closed 3 years ago

andyzhangx commented 3 years ago

this PR is for https://github.com/kubernetes-csi/csi-driver-nfs/pull/166 to build multi-arch images original error:

#7 [3/3] RUN apt update && apt install ca-certificates mount nfs-common nfs...
#7 0.115 /bin/sh: Invalid ELF image for this architecture
#7 ERROR: executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt update && apt install ca-certificates mount nfs-common nfs-kernel-server -y || true]: exit code: 255

https://prow.k8s.io/view/gcs/kubernetes-jenkins/logs/post-csi-driver-nfs-push-images/1363278699297771520

Does this PR introduce a user-facing change?:

none
andyzhangx commented 3 years ago

/release-label-none

andyzhangx commented 3 years ago

/release-label none

pohly commented 3 years ago

Why is this only relevant for the csi-driver-nfs? Can it break some other project when we merge this?

andyzhangx commented 3 years ago

Why is this only relevant for the csi-driver-nfs? Can it break some other project when we merge this?

@pohly nfs Dockerfile add nfs package which is distro relevant, --build-arg a=b just add a new arg for Dockerfile, if ARG a does not exist in Dockerfile, it just ignore and won't break.

Add an ARCH in build arg is necessary since not all CSI drivers could use gcr.io/distroless/static:latest base image since some CSI drivers needs to install some packages which is distro relevant

pohly commented 3 years ago

That explanation makes sense. Can you put it into the commit message?

andyzhangx commented 3 years ago

That explanation makes sense. Can you put it into the commit message?

done, I set commit msg like this:

add build-arg ARCH for building multi-arch images, e.g. …

ARG ARCH
FROM k8s.gcr.io/build-image/debian-base-${ARCH}:v2.1.3
pohly commented 3 years ago

This is not how commit messages are normally written (https://chris.beams.io/posts/git-commit/), but okay.

pohly commented 3 years ago

/approve

k8s-ci-robot commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, pohly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-csi/csi-release-tools/blob/master/OWNERS)~~ [pohly] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment