From 8d98aaf8676ac5340e2a705bf8795a919e8a1578 Mon Sep 17 00:00:00 2001 From: Kun-Lu Date: Fri, 17 Sep 2021 16:20:15 -0400 Subject: [PATCH 1/5] Add s390x support to docker images 1. add s390x support to docker images `executor`, `executor(slim)`, `executor(debug)` and `warmer`. Fixes #1462 and #1665. 2. Address the building issue of dependency `docker-credential-gcr` in Dockerfiles. This issue was introduced when recent commits in `docker-credential-gcr` removed the Makefile. Signed-off-by: Kun-Lu --- .github/workflows/release.yaml | 14 +++++++------- deploy/Dockerfile | 4 ++-- deploy/Dockerfile_debug | 11 ++++++++--- deploy/Dockerfile_warmer | 9 +++++++-- hack/install_golint.sh | 1 + 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 924e5dd6ea..c35c0c0b7b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le" + PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x" runs-on: ubuntu-latest steps: - name: Clone source code @@ -56,7 +56,7 @@ jobs: with: context: . file: ./deploy/Dockerfile_slim - platforms: linux/amd64,linux/arm64,linux/ppc64le + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x push: true tags: | gcr.io/kaniko-project/executor:${{ env.GITHUB_SHA }}-slim @@ -67,7 +67,7 @@ jobs: with: context: . file: ./deploy/Dockerfile - platforms: linux/amd64,linux/arm64,linux/ppc64le + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x push: true tags: | gcr.io/kaniko-project/executor:${{ env.GITHUB_SHA }} @@ -94,7 +94,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le" + PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x" runs-on: ubuntu-latest steps: - name: Clone source code @@ -140,7 +140,7 @@ jobs: with: context: . file: ./deploy/Dockerfile_debug - platforms: linux/amd64,linux/arm64,linux/ppc64le + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x push: true tags: | gcr.io/kaniko-project/executor:${{ env.GITHUB_SHA }}-debug @@ -163,7 +163,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le" + PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x" runs-on: ubuntu-latest steps: - name: Clone source code @@ -208,7 +208,7 @@ jobs: with: context: . file: ./deploy/Dockerfile_warmer - platforms: linux/amd64,linux/arm64,linux/ppc64le + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x push: true tags: | gcr.io/kaniko-project/warmer:${{ env.GITHUB_SHA }} diff --git a/deploy/Dockerfile b/deploy/Dockerfile index 37c4a059d2..01ad4e8242 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -32,7 +32,7 @@ RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \ cd /go/src/github.com/GoogleCloudPlatform && \ git clone https://github.com/GoogleCloudPlatform/docker-credential-gcr.git && \ cd /go/src/github.com/GoogleCloudPlatform/docker-credential-gcr && \ - make deps OUT_DIR=/usr/local/bin && \ + go get -u -t ./... && \ go build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go # Get Amazon ECR credential helper @@ -50,7 +50,7 @@ RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/chrismellard || true) RUN mkdir -p /kaniko/.docker COPY . . -RUN make GOARCH=$(cat /goarch.txt) +RUN make GOARCH=$(cat /goarch) # Generate latest ca-certificates diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 21d4354ea3..64836af5ee 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -30,8 +30,13 @@ RUN cat /goarch # Get GCR credential helper -ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.0.1/docker-credential-gcr_linux_$GOARCH-2.0.1.tar.gz /usr/local/bin/ - RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_$GOARCH-2.0.1.tar.gz +RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \ + (mkdir -p /go/src/github.com/GoogleCloudPlatform || true) && \ + cd /go/src/github.com/GoogleCloudPlatform && \ + git clone https://github.com/GoogleCloudPlatform/docker-credential-gcr.git && \ + cd /go/src/github.com/GoogleCloudPlatform/docker-credential-gcr && \ + go get -u -t ./... && \ + go build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go # Get Amazon ECR credential helper RUN GOARCH=$(cat /goarch) && go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login && \ @@ -48,7 +53,7 @@ RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/chrismellard || true) RUN mkdir -p /kaniko/.docker COPY . . -RUN make GOARCH=$(cat /goarch) && make GOARCH=$(cat /goarch.txt) out/warmer +RUN make GOARCH=$(cat /goarch) && make GOARCH=$(cat /goarch) out/warmer # Generate latest ca-certificates diff --git a/deploy/Dockerfile_warmer b/deploy/Dockerfile_warmer index f8ddca1519..36e350f63c 100644 --- a/deploy/Dockerfile_warmer +++ b/deploy/Dockerfile_warmer @@ -27,8 +27,13 @@ RUN [ ! "x" = "x$TARGETPLATFORM" ] && `echo $TARGETPLATFORM | awk '{split($0,a, RUN echo "I am runninng $TARGETPLATFORM with $(cat /goarch)" # Get GCR credential helper -ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.0.1/docker-credential-gcr_linux_$GOARCH-2.0.1.tar.gz /usr/local/bin/ - RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_$GOARCH-2.0.1.tar.gz +RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \ + (mkdir -p /go/src/github.com/GoogleCloudPlatform || true) && \ + cd /go/src/github.com/GoogleCloudPlatform && \ + git clone https://github.com/GoogleCloudPlatform/docker-credential-gcr.git && \ + cd /go/src/github.com/GoogleCloudPlatform/docker-credential-gcr && \ + go get -u -t ./... && \ + go build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go # Get Amazon ECR credential helper RUN GOARCH=$(cat /goarch) && go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login && \ diff --git a/hack/install_golint.sh b/hack/install_golint.sh index d0b0697704..64e00fb485 100755 --- a/hack/install_golint.sh +++ b/hack/install_golint.sh @@ -70,6 +70,7 @@ is_supported_platform() { linux/amd64) found=0 ;; linux/386) found=0 ;; linux/ppc64le) found=0 ;; + linux/s390x) found=0 ;; esac return $found } From b1046b9d027ccc4a0b9284c0c4d3f693d3d4a3b2 Mon Sep 17 00:00:00 2001 From: Kun-Lu Date: Wed, 20 Oct 2021 17:04:06 -0400 Subject: [PATCH 2/5] Add s390x support to all images except debug image --- .github/workflows/pr_release.yaml | 8 ++++---- .github/workflows/release.yaml | 8 ++++---- deploy/Dockerfile_debug | 11 ++--------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pr_release.yaml b/.github/workflows/pr_release.yaml index 75f164c5ff..413e953b8a 100644 --- a/.github/workflows/pr_release.yaml +++ b/.github/workflows/pr_release.yaml @@ -94,7 +94,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64" + PLATFORMS: "linux/amd64,linux/arm64,linux/s390x" runs-on: ubuntu-latest steps: - name: Clone source code @@ -126,7 +126,7 @@ jobs: with: context: . file: ./deploy/Dockerfile_warmer - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x tags: | gcr.io/kaniko-project/warmer:${{ env.GITHUB_SHA }} @@ -134,7 +134,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64" + PLATFORMS: "linux/amd64,linux/arm64,linux/s390x" runs-on: ubuntu-latest steps: - name: Clone source code @@ -166,6 +166,6 @@ jobs: with: context: . file: ./deploy/Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x tags: | gcr.io/kaniko-project/executor:${{ env.GITHUB_SHA }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 107b1de7f9..747b888dcc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64" + PLATFORMS: "linux/amd64,linux/arm64,linux/s390x" runs-on: ubuntu-latest steps: @@ -57,7 +57,7 @@ jobs: with: context: . file: ./deploy/Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x push: true tags: | gcr.io/kaniko-project/executor:${{ env.GITHUB_SHA }} @@ -153,7 +153,7 @@ jobs: env: GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - PLATFORMS: "linux/amd64,linux/arm64" + PLATFORMS: "linux/amd64,linux/arm64,linux/s390x" runs-on: ubuntu-latest steps: - name: Clone source code @@ -198,7 +198,7 @@ jobs: with: context: . file: ./deploy/Dockerfile_warmer - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x push: true tags: | gcr.io/kaniko-project/warmer:${{ env.GITHUB_SHA }} diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 64833c79a5..ae0b0561ce 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -30,15 +30,8 @@ RUN cat /goarch # Get GCR credential helper -RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \ - (mkdir -p /go/src/github.com/GoogleCloudPlatform || true) && \ - cd /go/src/github.com/GoogleCloudPlatform && \ - git clone https://github.com/GoogleCloudPlatform/docker-credential-gcr.git && \ - cd /go/src/github.com/GoogleCloudPlatform/docker-credential-gcr && \ - git checkout 4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8 && \ - go get -u -t ./... && \ - go build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go - +ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.0.1/docker-credential-gcr_linux_$GOARCH-2.0.1.tar.gz /usr/local/bin/ +RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_$GOARCH-2.0.1.tar.gz # Get Amazon ECR credential helper RUN GOARCH=$(cat /goarch) && go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login && \ From fa581ae4410a724831fa14143df7b0240dd166a8 Mon Sep 17 00:00:00 2001 From: Kun-Lu Date: Tue, 4 Jan 2022 09:18:44 -0500 Subject: [PATCH 3/5] Add s390x support to images.yaml --- .github/workflows/images.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index 5d0ae51c26..af9c751241 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -33,14 +33,14 @@ jobs: include: - image: executor dockerfile: ./deploy/Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x image-name: gcr.io/kaniko-project/executor tag: ${{ github.sha }} release-tag: latest - image: executor-debug dockerfile: ./deploy/Dockerfile_debug - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x image-name: gcr.io/kaniko-project/executor tag: ${{ github.sha }}-debug release_tag: debug @@ -54,7 +54,7 @@ jobs: - image: warmer dockerfile: ./deploy/Dockerfile_warmer - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/s390x image-name: gcr.io/kaniko-project/warmer tag: ${{ github.sha }} release-tag: latest From 524a2813bf14ec6fb815c19c26bff6364eb25ddc Mon Sep 17 00:00:00 2001 From: Kun-Lu Date: Tue, 4 Jan 2022 16:03:58 -0500 Subject: [PATCH 4/5] Fix ld64.so.1 not found issue on s390x --- deploy/Dockerfile_debug | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 363e1c7ef5..991e5fb430 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -57,6 +57,7 @@ COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr COPY --from=0 /usr/local/bin/docker-credential-ecr-login /kaniko/docker-credential-ecr-login COPY --from=0 /usr/local/bin/docker-credential-acr-env /kaniko/docker-credential-acr-env COPY --from=busybox:1.32.0 /bin /busybox +COPY --from=busybox:1.32.0 /*lib /lib # Declare /busybox as a volume to get it automatically in the path to ignore VOLUME /busybox From ed6e2e5ce6f0ebf96b8a205fd886a6dedc6d94ee Mon Sep 17 00:00:00 2001 From: Kun-Lu Date: Wed, 5 Jan 2022 10:56:37 -0500 Subject: [PATCH 5/5] Add a comment for copying /lib from busybox container on s390x --- deploy/Dockerfile_debug | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 991e5fb430..3ed7c2dc11 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -57,6 +57,10 @@ COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr COPY --from=0 /usr/local/bin/docker-credential-ecr-login /kaniko/docker-credential-ecr-login COPY --from=0 /usr/local/bin/docker-credential-acr-env /kaniko/docker-credential-acr-env COPY --from=busybox:1.32.0 /bin /busybox +# Since busybox needs some lib files which lie in /lib directory to run the executables on s390x, +# the below COPY command is added to address "ld64.so.1 not found" issue. This extra copy action will not +# happen on amd64 or arm64 platforms since /lib does not exist in amd64 or arm64 version of busybox container. +# Similar issues could be found in https://github.com/multiarch/qemu-user-static/issues/110#issuecomment-652951564. COPY --from=busybox:1.32.0 /*lib /lib # Declare /busybox as a volume to get it automatically in the path to ignore VOLUME /busybox