Skip to content

Commit 9f65174

Browse files
authored
Generate the config.json from gcloud rather than relying on a hardcoded one. (GoogleContainerTools#551)
marketplace.gcr.io now requires auth, but our credential helper doesn't know that.
1 parent c251430 commit 9f65174

File tree

7 files changed

+15
-25
lines changed

7 files changed

+15
-25
lines changed

deploy/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
FROM golang:1.10
1818
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko
1919
# Get GCR credential helper
20-
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.4.3-static/docker-credential-gcr_linux_amd64-1.4.3.tar.gz /usr/local/bin/
21-
RUN tar -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-1.4.3.tar.gz
20+
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_amd64-1.5.0.tar.gz /usr/local/bin/
21+
RUN tar -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-1.5.0.tar.gz
22+
RUN docker-credential-gcr configure-docker
2223
# Get Amazon ECR credential helper
2324
RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
2425
RUN make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper linux-amd64
@@ -31,7 +32,7 @@ COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/executor /kanik
3132
COPY --from=0 /usr/local/bin/docker-credential-gcr /kaniko/docker-credential-gcr
3233
COPY --from=0 /go/src/github.com/awslabs/amazon-ecr-credential-helper/bin/linux-amd64/docker-credential-ecr-login /kaniko/docker-credential-ecr-login
3334
COPY files/ca-certificates.crt /kaniko/ssl/certs/
34-
COPY files/config.json /kaniko/.docker/
35+
COPY --from=0 /root/.docker/config.json /kaniko/.docker/config.json
3536
ENV HOME /root
3637
ENV USER /root
3738
ENV PATH /usr/local/bin:/kaniko

deploy/Dockerfile_debug

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
FROM golang:1.10
1919
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko
2020
# Get GCR credential helper
21-
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.4.3-static/docker-credential-gcr_linux_amd64-1.4.3.tar.gz /usr/local/bin/
22-
RUN tar -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-1.4.3.tar.gz
21+
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_amd64-1.5.0.tar.gz /usr/local/bin/
22+
RUN tar -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-1.5.0.tar.gz
23+
RUN docker-credential-gcr configure-docker
2324
# Get Amazon ECR credential helper
2425
RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
2526
RUN make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper linux-amd64
@@ -41,7 +42,7 @@ COPY --from=1 /distroless/bazel-genfiles/experimental/busybox/busybox/ /busybox/
4142
# Declare /busybox as a volume to get it automatically whitelisted
4243
VOLUME /busybox
4344
COPY files/ca-certificates.crt /kaniko/ssl/certs/
44-
COPY files/config.json /kaniko/.docker/
45+
COPY --from=0 /root/.docker/config.json /kaniko/.docker/config.json
4546
ENV HOME /root
4647
ENV USER /root
4748
ENV PATH /usr/local/bin:/kaniko:/busybox

deploy/Dockerfile_warmer

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ RUN make out/warmer
2222
FROM scratch
2323
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/warmer /kaniko/warmer
2424
COPY files/ca-certificates.crt /kaniko/ssl/certs/
25-
COPY files/config.json /kaniko/.docker/
2625
ENV HOME /root
2726
ENV USER /root
2827
ENV PATH /usr/local/bin:/kaniko

files/config.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

integration/dockerfiles/Dockerfile_onbuild_base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM gcr.io/google-appengine/debian9@sha256:1d6a9a6d106bd795098f60f4abb7083626354fa6735e81743c7f8cfca11259f0
1+
FROM marketplace.gcr.io/google/ubuntu1804@sha256:4649ae6b381090fba6db38137eb05e03f44bf43c40149f734241c9f96aa0e001
22
ENV dir /tmp/dir/
33
ONBUILD RUN echo "onbuild" > /tmp/onbuild
44
ONBUILD RUN mkdir $dir

integration/images.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
165165
)
166166

167167
timer := timing.Start(dockerfile + "_docker")
168-
_, err := RunCommandWithoutTest(dockerCmd)
168+
out, err := RunCommandWithoutTest(dockerCmd)
169169
timing.DefaultRun.Stop(timer)
170170
if err != nil {
171-
return fmt.Errorf("Failed to build image %s with docker command \"%s\": %s", dockerImage, dockerCmd.Args, err)
171+
return fmt.Errorf("Failed to build image %s with docker command \"%s\": %s %s", dockerImage, dockerCmd.Args, err, string(out))
172172
}
173173

174174
contextFlag := "-c"
@@ -219,10 +219,10 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
219219
)
220220

221221
timer = timing.Start(dockerfile + "_kaniko")
222-
_, err = RunCommandWithoutTest(kanikoCmd)
222+
out, err = RunCommandWithoutTest(kanikoCmd)
223223
timing.DefaultRun.Stop(timer)
224224
if err != nil {
225-
return fmt.Errorf("Failed to build image %s with kaniko command \"%s\": %s", dockerImage, kanikoCmd.Args, err)
225+
return fmt.Errorf("Failed to build image %s with kaniko command \"%s\": %s %s", dockerImage, kanikoCmd.Args, err, string(out))
226226
}
227227

228228
d.FilesBuilt[dockerfile] = true

integration/integration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ func TestMain(m *testing.M) {
175175
for _, setupCmd := range setupCommands {
176176
fmt.Println(setupCmd.name)
177177
cmd := exec.Command(setupCmd.command[0], setupCmd.command[1:]...)
178-
if _, err := RunCommandWithoutTest(cmd); err != nil {
178+
if out, err := RunCommandWithoutTest(cmd); err != nil {
179179
fmt.Printf("%s failed: %s", setupCmd.name, err)
180+
fmt.Println(string(out))
180181
os.Exit(1)
181182
}
182183
}

0 commit comments

Comments
 (0)