From 86c717953052111c68b382487c5611bfa2725dc8 Mon Sep 17 00:00:00 2001 From: dcherniv Date: Mon, 18 Jun 2018 19:32:53 -0400 Subject: [PATCH] [442] - fixing incorrect position of tarPath argument (#693) * [442] - fixing incorrect position of tarPath argument * Final verdict is p needs to absolute, tarPath needs to be relative and everything is peachy --- pkg/skaffold/docker/context_test.go | 1 - pkg/skaffold/util/tar.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/skaffold/docker/context_test.go b/pkg/skaffold/docker/context_test.go index 1395156c9c1..d766da1d5cf 100644 --- a/pkg/skaffold/docker/context_test.go +++ b/pkg/skaffold/docker/context_test.go @@ -43,7 +43,6 @@ func TestDockerContext(t *testing.T) { ioutil.WriteFile(filepath.Join(tmpDir, "Dockerfile"), []byte("FROM alpine\nCOPY ./files /files"), 0644) ioutil.WriteFile(filepath.Join(tmpDir, "ignored.txt"), []byte(""), 0644) ioutil.WriteFile(filepath.Join(tmpDir, "alsoignored.txt"), []byte(""), 0644) - reader, writer := io.Pipe() go func() { err := CreateDockerTarContext(writer, "Dockerfile", tmpDir) diff --git a/pkg/skaffold/util/tar.go b/pkg/skaffold/util/tar.go index f6383721a8b..92bce488e0b 100644 --- a/pkg/skaffold/util/tar.go +++ b/pkg/skaffold/util/tar.go @@ -32,9 +32,9 @@ func CreateTar(w io.Writer, root string, paths []string) error { defer tw.Close() for _, p := range paths { - tarPath := filepath.ToSlash(filepath.Join(root, p)) - - if err := addFileToTar(tarPath, p, tw); err != nil { + tarPath := filepath.ToSlash(p) + p := filepath.Join(root, p) + if err := addFileToTar(p, tarPath, tw); err != nil { return err }