Skip to content

Commit

Permalink
Merge branch 'master' of github.com:GoogleContainerTools/kaniko into …
Browse files Browse the repository at this point in the history
…snapshot
  • Loading branch information
Priya Wadhwa committed Jun 21, 2018
2 parents b09526b + 9ad8647 commit 8453a5b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
6 changes: 3 additions & 3 deletions deploy/Dockerfile_debug
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/snapshot/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/command_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/fs_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions pkg/util/fs_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
"/",
},
},
}

Expand Down

0 comments on commit 8453a5b

Please sign in to comment.