From 98826ef9511c49e256441bcc83d9fe635e650625 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Wed, 7 Mar 2018 15:38:22 -0800 Subject: [PATCH] Changed /work-dir to /kbuild --- Makefile | 2 +- integration_tests/executor/Dockerfile | 2 +- integration_tests/integration_test_yaml.go | 2 +- pkg/snapshot/snapshot_test.go | 18 +++++++++--------- pkg/util/fs_util.go | 2 +- pkg/util/fs_util_test.go | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 80e9fe5f2..df2a2ea82 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ out/executor: $(GO_FILES) out/kbuild: $(GO_FILES) - GOOS=$* GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags $(GO_LDFLAGS) -tags $(GO_BUILD_TAGS) -o $@ $(KBUILD_PACKAGE) + GOOS=$* GOARCH=$(GOARCH) CGO_ENABLED=1 go build -ldflags $(GO_LDFLAGS) -tags $(GO_BUILD_TAGS) -o $@ $(KBUILD_PACKAGE) .PHONY: test test: out/executor out/kbuild diff --git a/integration_tests/executor/Dockerfile b/integration_tests/executor/Dockerfile index 9a4595d48..1149c2726 100644 --- a/integration_tests/executor/Dockerfile +++ b/integration_tests/executor/Dockerfile @@ -15,5 +15,5 @@ # Builds the static Go image to execute in a Kubernetes job FROM scratch -ADD out/executor /work-dir/executor +ADD out/executor /kbuild/executor ADD files/ca-certificates.crt /etc/ssl/certs/ diff --git a/integration_tests/integration_test_yaml.go b/integration_tests/integration_test_yaml.go index c11b901ec..7c59e2e08 100644 --- a/integration_tests/integration_test_yaml.go +++ b/integration_tests/integration_test_yaml.go @@ -48,7 +48,7 @@ type testyaml struct { } var executorImage = "executor-image" -var executorCommand = "/work-dir/executor" +var executorCommand = "/kbuild/executor" var dockerImage = "gcr.io/cloud-builders/docker" var ubuntuImage = "ubuntu" var testRepo = "gcr.io/kbuild-test/" diff --git a/pkg/snapshot/snapshot_test.go b/pkg/snapshot/snapshot_test.go index 22263aed3..5e51d88bc 100644 --- a/pkg/snapshot/snapshot_test.go +++ b/pkg/snapshot/snapshot_test.go @@ -37,9 +37,9 @@ func TestSnapshotFileChange(t *testing.T) { } // Make some changes to the filesystem newFiles := map[string]string{ - "foo": "newbaz1", - "bar/bat": "baz", - "work-dir/bat": "bat", + "foo": "newbaz1", + "bar/bat": "baz", + "kbuild/bat": "bat", } if err := testutil.SetupFiles(testDir, newFiles); err != nil { t.Fatalf("Error setting up fs: %s", err) @@ -134,15 +134,15 @@ func TestSnapshotFiles(t *testing.T) { } // Make some changes to the filesystem newFiles := map[string]string{ - "foo": "newbaz1", - "work-dir/file": "bat", + "foo": "newbaz1", + "kbuild/file": "bat", } if err := testutil.SetupFiles(testDir, newFiles); err != nil { t.Fatalf("Error setting up fs: %s", err) } filesToSnapshot := []string{ filepath.Join(testDir, "foo"), - filepath.Join(testDir, "work-dir/file"), + filepath.Join(testDir, "kbuild/file"), } contents, err := snapshotter.TakeSnapshotOfFiles(filesToSnapshot) if err != nil { @@ -197,9 +197,9 @@ func setUpTestDir() (string, *Snapshotter, error) { return testDir, nil, errors.Wrap(err, "setting up temp dir") } files := map[string]string{ - "foo": "baz1", - "bar/bat": "baz2", - "work-dir/file": "file", + "foo": "baz1", + "bar/bat": "baz2", + "kbuild/file": "file", } // Set up initial files if err := testutil.SetupFiles(testDir, files); err != nil { diff --git a/pkg/util/fs_util.go b/pkg/util/fs_util.go index 7e767b8d5..eafd18916 100644 --- a/pkg/util/fs_util.go +++ b/pkg/util/fs_util.go @@ -28,7 +28,7 @@ import ( "strings" ) -var whitelist = []string{"/work-dir"} +var whitelist = []string{"/kbuild"} // ExtractFileSystemFromImage pulls an image and unpacks it to a file system at root func ExtractFileSystemFromImage(img string) error { diff --git a/pkg/util/fs_util_test.go b/pkg/util/fs_util_test.go index a474794c4..ccb7b3658 100644 --- a/pkg/util/fs_util_test.go +++ b/pkg/util/fs_util_test.go @@ -46,7 +46,7 @@ func Test_fileSystemWhitelist(t *testing.T) { } actualWhitelist, err := fileSystemWhitelist(path) - expectedWhitelist := []string{"/work-dir", "/proc", "/dev", "/dev/pts", "/sys"} + expectedWhitelist := []string{"/kbuild", "/proc", "/dev", "/dev/pts", "/sys"} sort.Strings(actualWhitelist) sort.Strings(expectedWhitelist) testutil.CheckErrorAndDeepEqual(t, false, err, expectedWhitelist, actualWhitelist)