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

Mutli-arch support #1531

Merged
merged 39 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
afda9a2
initial commit
tejal29 Dec 22, 2020
52c6cec
remove bazel jobs
tejal29 Dec 22, 2020
a32b62e
fix arch
tejal29 Dec 22, 2020
43374c0
more fixes after testing and code review comments
tejal29 Dec 22, 2020
e1df7c9
fix build platform
tejal29 Dec 23, 2020
28bc5a7
add individual cloudbuild.yaml as its taking 45 mins for a cloud buil…
tejal29 Dec 23, 2020
29ab2e7
add buildx plugin
tejal29 Dec 23, 2020
895075c
add more debugging
tejal29 Dec 23, 2020
a136303
update busybox version to fix CVE-2018-1000500
ankitm123 Dec 23, 2020
82088f9
fix
tejal29 Dec 23, 2020
528205d
lint + more debug
tejal29 Dec 23, 2020
22f5cfc
fix
tejal29 Dec 23, 2020
6f95497
fix
tejal29 Dec 23, 2020
3d58ca0
fix
tejal29 Dec 23, 2020
738c1f7
remove images from cloudbiuld
tejal29 Dec 23, 2020
53c6c65
move CI job back to docker
tejal29 Dec 23, 2020
bd82682
one more fix
tejal29 Dec 23, 2020
6952749
lets see
tejal29 Dec 23, 2020
5ceb1b8
bring it back
tejal29 Dec 24, 2020
9d7d085
move CI job back to docker
tejal29 Dec 24, 2020
aca6650
remove aerg from top
tejal29 Dec 24, 2020
de93fb9
live restart config
tejal29 Dec 24, 2020
3c2a383
remove live restore as minikube setup failed
tejal29 Jan 5, 2021
a0a938c
add --force-systemd
tejal29 Jan 6, 2021
b11e3a5
add --force-systemd and docker driver none
tejal29 Jan 6, 2021
4a54412
change the --run flag
tejal29 Jan 6, 2021
9cccd53
docker info and some logs removed
tejal29 Jan 6, 2021
d16c751
fix docker command
tejal29 Jan 6, 2021
0cda969
upgrade version for buildx to 0.5.1
tejal29 Jan 6, 2021
16b54c2
remove docker service from travis.yml and add systemd cgroup config
tejal29 Jan 7, 2021
47c0a4b
move the docker config up
tejal29 Jan 7, 2021
e54e306
move them back to docker build
tejal29 Jan 25, 2021
a67b9f7
fix
tejal29 Jan 25, 2021
990b31d
fix all dockerfiles
tejal29 Jan 25, 2021
3f624e7
fix warmer
tejal29 Jan 25, 2021
dd3806a
fix
tejal29 Jan 25, 2021
4b6b957
rm bazel jobs
tejal29 Jan 25, 2021
a63211a
add more logs
tejal29 Jan 25, 2021
edb2dc8
fix debug
tejal29 Jan 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions .github/workflows/release.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,3 @@ jobs:
script:
- make integration-test-misc

- name: bazel amd64
arch: amd64
env: CPU=k8
before_install: &before_install_multiarch
- export PATH=$PATH:$HOME/bin && mkdir -p $HOME/bin
- eval $(go env)
# install bazelisk as bazel to install the appropriate bazel version
- wget https://github.com/bazelbuild/bazelisk/releases/download/v1.6.1/bazelisk-linux-${GOARCH} && chmod +x bazelisk-linux-${GOARCH} && mv bazelisk-linux-${GOARCH} $HOME/bin/bazel
script: &script_multiarch
# Generate BUILD.bazel files (we do not check them in)
- bazel run //:gazelle
- bazel build --cpu=${CPU} --curses=no //integration:all
# Build all targets tagged with our architecture:
- bazel build --cpu=${CPU} --curses=no $(bazel query 'attr("tags", "'${GOARCH}'", "//...")')
# Run all tests not tagged as "manual":
- bazel test --cpu=${CPU} --curses=no --test_output=errors --test_timeout=900 //integration:all
# Run all tests tagged with our architecture:
- bazel test --cpu=${CPU} --curses=no --test_output=errors --test_timeout=900 $(bazel query 'attr("tags", "'${GOARCH}'", "//...")')

- name: bazel arm64
arch: arm64
env: CPU=aarch64
before_install: *before_install_multiarch
script: *script_multiarch
4 changes: 0 additions & 4 deletions BUILD

This file was deleted.

53 changes: 0 additions & 53 deletions WORKSPACE

This file was deleted.

61 changes: 0 additions & 61 deletions cmd/executor/BUILD

This file was deleted.

12 changes: 6 additions & 6 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
FROM golang:1.14
ARG GOARCH=amd64
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

RUN echo $GOARCH > /goarch

#This arg is passed by docker buildx & contains the platform info in the form linux/amd64, linux/ppc64le etc.
ARG TARGETPLATFORM

#Capture ARCH has write to /goarch
RUN [ ! "x" = "x$TARGETPLATFORM" ] && `echo $TARGETPLATFORM | awk '{split($0,a,"/"); print a[2]}' > /goarch` || echo "$GOARCH"
RUN echo "I am runninng $TARGETPLATFORM with with $(cat /goarch)"

# Get GCR credential helper
RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \
Expand All @@ -33,13 +33,13 @@ RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \
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 build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go
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 && \
make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper

# ACR docker credential helper
# Azure docker credential helper
COPY ./acr.patch /
RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/Azure || true) && \
cd /go/src/github.com/Azure && \
Expand All @@ -48,8 +48,8 @@ RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/Azure || true) && \
git checkout a79b541f3ee761f6cc4511863ed41fb038c19464 && \
git apply < /acr.patch && \
make && cp -f bin/linux/${GOARCH}/docker-credential-acr-linux /usr/local/bin/docker-credential-acr-linux
#ACR docker env credential helper

# ACR docker env credential helper
RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/chrismellard || true) && \
cd /go/src/github.com/chrismellard && \
git clone https://github.com/chrismellard/docker-credential-acr-env && \
Expand All @@ -60,7 +60,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)

FROM scratch
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/executor /kaniko/executor
Expand Down
52 changes: 40 additions & 12 deletions deploy/Dockerfile_debug
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,60 @@
# Stage 0: Build the executor binary and get credential helpers
FROM golang:1.14
ARG GOARCH=amd64
RUN echo $GOARCH > /goarch

#This arg is passed by docker buildx & contains the platform info in the form linux/amd64, linux/ppc64le etc.
ARG TARGETPLATFORM

#Capture ARCH has write to /goarch
RUN [ ! "x" = "x$TARGETPLATFORM" ] && `echo $TARGETPLATFORM | awk '{split($0,a,"/"); print a[2]}' > /goarch` || echo "$GOARCH"
RUN echo "I am runninng $TARGETPLATFORM with with $(cat /goarch)"
RUN cat /goarch

WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

# Get GCR credential helper
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.0.2/docker-credential-gcr_linux_amd64-2.0.2.tar.gz /usr/local/bin/
RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-2.0.2.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 && \
make deps OUT_DIR=/usr/local/bin && \
go build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go

# Get Amazon ECR credential helper
RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
RUN make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper linux-amd64
RUN GOARCH=$(cat /goarch) && go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login && \
make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper

# ACR docker credential helper
ADD https://aadacr.blob.core.windows.net/acr-docker-credential-helper/docker-credential-acr-linux-amd64.tar.gz /usr/local/bin
RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-acr-linux-amd64.tar.gz
# ACR docker env credential helper
ADD https://github.com/chrismellard/docker-credential-acr-env/releases/download/0.6.0/docker-credential-acr-env_0.6.0_Linux_x86_64.tar.gz /usr/local/bin/
RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-acr-env_0.6.0_Linux_x86_64.tar.gz
COPY ./acr.patch /
RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/Azure || true) && \
cd /go/src/github.com/Azure && \
git clone https://github.com/Azure/acr-docker-credential-helper && \
cd /go/src/github.com/Azure/acr-docker-credential-helper && \
git checkout a79b541f3ee761f6cc4511863ed41fb038c19464 && \
git apply < /acr.patch && \
make && cp -f bin/linux/${GOARCH}/docker-credential-acr-linux /usr/local/bin/docker-credential-acr-linux

#ACR docker env credential helper
RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/chrismellard || true) && \
cd /go/src/github.com/chrismellard && \
git clone https://github.com/chrismellard/docker-credential-acr-env && \
cd docker-credential-acr-env && \
make build && cp -f ./build/docker-credential-acr-env /usr/local/bin

# Add .docker config dir
RUN mkdir -p /kaniko/.docker

COPY . .
RUN make GOARCH=${GOARCH} && make out/warmer
RUN make GOARCH=$(cat /goarch) && make GOARCH=$(cat /goarch.txt) out/warmer

FROM scratch
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/* /kaniko/
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/warmer /kaniko/warmer
COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr
COPY --from=0 /go/src/github.com/awslabs/amazon-ecr-credential-helper/bin/linux-amd64/docker-credential-ecr-login /kaniko/docker-credential-ecr-login
COPY --from=0 /go/src/github.com/awslabs/amazon-ecr-credential-helper/bin/local/docker-credential-ecr-login /kaniko/docker-credential-ecr-login
COPY --from=0 /usr/local/bin/docker-credential-acr-linux /kaniko/docker-credential-acr
COPY --from=0 /usr/local/bin/docker-credential-acr-env /kaniko/docker-credential-acr-env
COPY --from=amd64/busybox:1.32.0 /bin /busybox

# Declare /busybox as a volume to get it automatically in the path to ignore
Expand Down
42 changes: 42 additions & 0 deletions deploy/Dockerfile_slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2020 Google, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Builds the static Go image to execute in a Kubernetes job
FROM golang:1.14 as build_env
ARG GOARCH=amd64
RUN echo $GOARCH > /goarch

#This arg is passed by docker buildx & contains the platform info in the form linux/amd64, linux/ppc64le etc.
ARG TARGETPLATFORM

#Capture ARCH has write to /goarch
RUN [ ! "x" = "x$TARGETPLATFORM" ] && `echo $TARGETPLATFORM | awk '{split($0,a,"/"); print a[2]}' > /goarch` || echo "$GOARCH"
RUN echo "I am runninng $TARGETPLATFORM with $(cat /goarch)"

WORKDIR /go/src/github.com/GoogleContainerTools/kaniko
COPY . .

RUN make GOARCH=$(cat /goarch)

FROM scratch
COPY --from=build_env /go/src/github.com/GoogleContainerTools/kaniko/out/executor /kaniko/executor
COPY files/nsswitch.conf /etc/nsswitch.conf
COPY files/ca-certificates.crt /kaniko/ssl/certs/
ENV HOME /root
ENV USER root
ENV PATH /usr/local/bin:/kaniko
ENV SSL_CERT_DIR=/kaniko/ssl/certs

ENTRYPOINT ["/kaniko/executor"]

Loading