From 1414a4d81e8cee62494cf107f9e851c8a0c04dda Mon Sep 17 00:00:00 2001 From: Joshua Knarr Date: Mon, 7 Oct 2019 09:18:42 -0400 Subject: [PATCH 1/8] adding BUILD_ARG --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4b9cb25df..d80e37953 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,11 @@ # Bump these on release VERSION_MAJOR ?= 0 -VERSION_MINOR ?= 13 +VERSION_MINOR ?= 12 VERSION_BUILD ?= 0 VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD) +VERSION_PACKAGE = $(REPOPATH/pkg/version) SHELL := /bin/bash GOOS ?= $(shell go env GOOS) @@ -27,7 +28,6 @@ PROJECT := kaniko REGISTRY?=gcr.io/kaniko-project REPOPATH ?= $(ORG)/$(PROJECT) -VERSION_PACKAGE = $(REPOPATH)/pkg/version GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*") GO_LDFLAGS := '-extldflags "-static" @@ -38,6 +38,7 @@ GO_LDFLAGS += ' EXECUTOR_PACKAGE = $(REPOPATH)/cmd/executor WARMER_PACKAGE = $(REPOPATH)/cmd/warmer KANIKO_PROJECT = $(REPOPATH)/kaniko +BUILD_ARG ?= '' out/executor: $(GO_FILES) GOARCH=$(GOARCH) GOOS=linux CGO_ENABLED=0 go build -ldflags $(GO_LDFLAGS) -o $@ $(EXECUTOR_PACKAGE) @@ -55,6 +56,7 @@ integration-test: .PHONY: images images: - docker build -t $(REGISTRY)/executor:latest -f deploy/Dockerfile . - docker build -t $(REGISTRY)/executor:debug -f deploy/Dockerfile_debug . - docker build -t $(REGISTRY)/warmer:latest -f deploy/Dockerfile_warmer . + docker build ${BUILD_ARG} -t $(REGISTRY)/executor:latest -f deploy/Dockerfile . + docker build ${BUILD_ARG} -t $(REGISTRY)/executor:debug -f deploy/Dockerfile_debug . + docker build ${BUILD_ARG} -t $(REGISTRY)/warmer:latest -f deploy/Dockerfile_warmer . + From be4c414307df877b67c3f635d6cf6f343ba880a4 Mon Sep 17 00:00:00 2001 From: Joshua Knarr Date: Mon, 7 Oct 2019 09:20:43 -0400 Subject: [PATCH 2/8] reconcile their newer version --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d80e37953..b35610671 100644 --- a/Makefile +++ b/Makefile @@ -14,11 +14,10 @@ # Bump these on release VERSION_MAJOR ?= 0 -VERSION_MINOR ?= 12 +VERSION_MINOR ?= 13 VERSION_BUILD ?= 0 VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD) -VERSION_PACKAGE = $(REPOPATH/pkg/version) SHELL := /bin/bash GOOS ?= $(shell go env GOOS) @@ -28,6 +27,7 @@ PROJECT := kaniko REGISTRY?=gcr.io/kaniko-project REPOPATH ?= $(ORG)/$(PROJECT) +VERSION_PACKAGE = $(REPOPATH/pkg/version) GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*") GO_LDFLAGS := '-extldflags "-static" From 6b206ad9ae17106afb02afa9ae015eafbc68357f Mon Sep 17 00:00:00 2001 From: Joshua Knarr Date: Mon, 7 Oct 2019 09:21:37 -0400 Subject: [PATCH 3/8] prefer theirs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b35610671..d9ea21d8f 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ PROJECT := kaniko REGISTRY?=gcr.io/kaniko-project REPOPATH ?= $(ORG)/$(PROJECT) -VERSION_PACKAGE = $(REPOPATH/pkg/version) +VERSION_PACKAGE = $(REPOPATH)/pkg/version GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*") GO_LDFLAGS := '-extldflags "-static" From c1bf3624009b28d9986d65e9440f1cdede1600c4 Mon Sep 17 00:00:00 2001 From: Petr Ruzicka Date: Wed, 9 Oct 2019 11:29:49 +0200 Subject: [PATCH 4/8] Details about --tarPath usage improved --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 11577d87b..13510dc2b 100644 --- a/README.md +++ b/README.md @@ -470,6 +470,7 @@ Set this flag to indicate which build stage is the target build stage. #### --tarPath Set this flag as `--tarPath=` to save the image as a tarball at path instead of pushing the image. +You need to set `--destination` as well (for example `--destination=image`). #### --verbosity From 894388693407e370438025b8b241551cb73ebcc2 Mon Sep 17 00:00:00 2001 From: slmagus Date: Wed, 16 Oct 2019 10:48:03 -0400 Subject: [PATCH 5/8] add make images to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b85d3832b..5f3ebbb63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,4 @@ go_import_path: github.com/GoogleContainerTools/kaniko script: - make test + - make images From 7413a516208ae11283d98f8d5490fa26f988c8d1 Mon Sep 17 00:00:00 2001 From: slmagus Date: Wed, 16 Oct 2019 10:53:39 -0400 Subject: [PATCH 6/8] fix docker build args value, as this passes in a literal double single quote --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d9ea21d8f..64701b087 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ GO_LDFLAGS += ' EXECUTOR_PACKAGE = $(REPOPATH)/cmd/executor WARMER_PACKAGE = $(REPOPATH)/cmd/warmer KANIKO_PROJECT = $(REPOPATH)/kaniko -BUILD_ARG ?= '' +BUILD_ARG ?= out/executor: $(GO_FILES) GOARCH=$(GOARCH) GOOS=linux CGO_ENABLED=0 go build -ldflags $(GO_LDFLAGS) -o $@ $(EXECUTOR_PACKAGE) From 297fd9743b30deee58ec534669cedc9f8139d083 Mon Sep 17 00:00:00 2001 From: slmagus Date: Wed, 16 Oct 2019 11:55:41 -0400 Subject: [PATCH 7/8] use the binary-bin directory as bazel-genfiles does not exist --- deploy/Dockerfile_debug | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 65428e864..39097c1ce 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -29,16 +29,16 @@ RUN make && make out/warmer # Stage 1: Get the busybox shell FROM gcr.io/cloud-builders/bazel:latest -RUN git clone https://github.com/GoogleContainerTools/distroless.git +RUN git clone https://github.com/slmagus/distroless.git WORKDIR /distroless RUN bazel build //experimental/busybox:busybox_tar -RUN tar -C /distroless/bazel-genfiles/experimental/busybox/ -xf /distroless/bazel-genfiles/experimental/busybox/busybox.tar +RUN tar -C /distroless/bazel-bin/experimental/busybox/ -xf /distroless/bazel-bin/experimental/busybox/busybox.tar FROM scratch COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/* /kaniko/ 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=1 /distroless/bazel-genfiles/experimental/busybox/busybox/ /busybox/ +COPY --from=1 /distroless/bazel-bin/experimental/busybox/busybox/ /busybox/ # Declare /busybox as a volume to get it automatically whitelisted VOLUME /busybox COPY files/ca-certificates.crt /kaniko/ssl/certs/ From c0b7ef33d5b06bf5eb5665684fa853a936c63bf8 Mon Sep 17 00:00:00 2001 From: slmagus Date: Wed, 16 Oct 2019 12:03:42 -0400 Subject: [PATCH 8/8] revert distroless repo from testing fork --- deploy/Dockerfile_debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 39097c1ce..c1e4107f7 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -29,7 +29,7 @@ RUN make && make out/warmer # Stage 1: Get the busybox shell FROM gcr.io/cloud-builders/bazel:latest -RUN git clone https://github.com/slmagus/distroless.git +RUN git clone https://github.com/GoogleContainerTools/distroless.git WORKDIR /distroless RUN bazel build //experimental/busybox:busybox_tar RUN tar -C /distroless/bazel-bin/experimental/busybox/ -xf /distroless/bazel-bin/experimental/busybox/busybox.tar