From c17b2d55330ab5be29f7a031b0cf6dfcd95e13af Mon Sep 17 00:00:00 2001 From: Nicolas Byl Date: Mon, 18 Jun 2018 23:35:15 +0200 Subject: [PATCH 1/3] fix build of debug image --- deploy/Dockerfile_debug | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index 520549435a..e547c6136e 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -30,14 +30,14 @@ RUN make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper linux-amd64 FROM gcr.io/cloud-builders/bazel:latest RUN git clone https://github.com/GoogleContainerTools/distroless.git WORKDIR /distroless -RUN bazel build busybox:busybox.tar -RUN tar -C /distroless/bazel-genfiles/busybox/ -xf /distroless/bazel-genfiles/busybox/busybox.tar +RUN bazel build //experimental/busybox:busybox.tar +RUN tar -C /distroless/bazel-genfiles/experimental/busybox/ -xf /distroless/bazel-genfiles/experimental/busybox/busybox.tar FROM scratch COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/executor /kaniko/executor 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/busybox/busybox/ /busybox/ +COPY --from=1 /distroless/bazel-genfiles/experimental/busybox/busybox/ /busybox/ COPY files/ca-certificates.crt /kaniko/ssl/certs/ COPY files/config.json /kaniko/.docker/ ENV HOME /root From f090b2fe8648254c2f73ae4c22d5ce79123f0fbd Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Wed, 20 Jun 2018 09:52:27 -0700 Subject: [PATCH 2/3] upload bucket test tarball in integration test --- integration-test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/integration-test.sh b/integration-test.sh index 02dd4b6889..8d2fe8e1b9 100755 --- a/integration-test.sh +++ b/integration-test.sh @@ -28,6 +28,11 @@ if [ -f "$KOKORO_GFILE_DIR"/common.sh ]; then cp $KOKORO_ROOT/src/keystore/72508_gcr_application_creds $HOME/.config/gcloud/application_default_credentials.json fi +echo "Creating build context tarball..." +tar -C ./integration -zcvf context.tar.gz . +gsutil cp context.tar.gz gs://kaniko-test-bucket +rm context.tar.gz + echo "Running integration tests..." make out/executor pushd integration From 54282e3e8c9bbb022325a6baf44367d72d485bed Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 21 Jun 2018 14:07:59 -0700 Subject: [PATCH 3/3] Fix bug in snapshotting --- pkg/snapshot/snapshot_test.go | 2 +- pkg/util/command_util.go | 2 +- pkg/util/fs_util.go | 4 ++-- pkg/util/fs_util_test.go | 9 ++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/snapshot/snapshot_test.go b/pkg/snapshot/snapshot_test.go index 7cee2ad118..f8f3c01618 100644 --- a/pkg/snapshot/snapshot_test.go +++ b/pkg/snapshot/snapshot_test.go @@ -149,7 +149,7 @@ func TestSnapshotFiles(t *testing.T) { if err != nil { t.Fatal(err) } - expectedFiles := []string{"/tmp", filepath.Join(testDir, "foo")} + expectedFiles := []string{"/", "/tmp", filepath.Join(testDir, "foo")} // Check contents of the snapshot, make sure contents is equivalent to snapshotFiles reader := bytes.NewReader(contents) diff --git a/pkg/util/command_util.go b/pkg/util/command_util.go index 8fcefca0d3..8d4bb37155 100644 --- a/pkg/util/command_util.go +++ b/pkg/util/command_util.go @@ -69,7 +69,7 @@ func ResolveEnvironmentReplacement(value string, envs []string, isFilepath bool) return "", err } fp = filepath.Clean(fp) - if IsDestDir(value) { + if IsDestDir(value) && !IsDestDir(fp) { fp = fp + "/" } return fp, nil diff --git a/pkg/util/fs_util.go b/pkg/util/fs_util.go index 7d8b6b456b..825009d7f7 100644 --- a/pkg/util/fs_util.go +++ b/pkg/util/fs_util.go @@ -336,12 +336,12 @@ func Files(root string) ([]string, error) { } // ParentDirectories returns a list of paths to all parent directories -// Ex. /some/temp/dir -> [/some, /some/temp, /some/temp/dir] +// Ex. /some/temp/dir -> [/, /some, /some/temp, /some/temp/dir] func ParentDirectories(path string) []string { path = filepath.Clean(path) dirs := strings.Split(path, "/") dirPath := constants.RootDir - var paths []string + paths := []string{constants.RootDir} for index, dir := range dirs { if dir == "" || index == (len(dirs)-1) { continue diff --git a/pkg/util/fs_util_test.go b/pkg/util/fs_util_test.go index 0feefd0ebe..a9c8716320 100644 --- a/pkg/util/fs_util_test.go +++ b/pkg/util/fs_util_test.go @@ -142,14 +142,17 @@ func Test_ParentDirectories(t *testing.T) { name: "regular path", path: "/path/to/dir", expected: []string{ + "/", "/path", "/path/to", }, }, { - name: "current directory", - path: ".", - expected: nil, + name: "current directory", + path: ".", + expected: []string{ + "/", + }, }, }