From 48f9968e5b152c78b5fe431416edb623bc06d8c4 Mon Sep 17 00:00:00 2001 From: dlorenc Date: Fri, 11 Jan 2019 16:04:16 -0700 Subject: [PATCH] Move the benchmark files from /workspace to their own mounted volume in tests. (#527) If we don't do this, they can end up in the built images causing test failures. --- benchmark.sh | 2 +- integration/images.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/benchmark.sh b/benchmark.sh index 53c3c648b..9409ce299 100755 --- a/benchmark.sh +++ b/benchmark.sh @@ -17,5 +17,5 @@ set -ex script_name=$0 script_full_path=$(dirname "$0") export BENCHMARK=true -export IMAGE_REPO="gcr.io/kaniko-test-project/benchmarks" +export IMAGE_REPO="gcr.io/kaniko-test/benchmarks" ./${script_full_path}/integration-test.sh diff --git a/integration/images.go b/integration/images.go index 6a380a722..f194a4033 100644 --- a/integration/images.go +++ b/integration/images.go @@ -18,6 +18,7 @@ package integration import ( "fmt" + "io/ioutil" "os" "os/exec" "path" @@ -188,9 +189,12 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do } benchmarkEnv := "BENCHMARK_FILE=false" + benchmarkDir, err := ioutil.TempDir("", "") + if err != nil { + return err + } if b, err := strconv.ParseBool(os.Getenv("BENCHMARK")); err == nil && b { - os.Mkdir("benchmarks", 0755) - benchmarkEnv = "BENCHMARK_FILE=/workspace/benchmarks/" + dockerfile + benchmarkEnv = "BENCHMARK_FILE=/kaniko/benchmarks/" + dockerfile } // build kaniko image @@ -199,6 +203,7 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do kanikoCmd := exec.Command("docker", append([]string{"run", "-v", os.Getenv("HOME") + "/.config/gcloud:/root/.config/gcloud", + "-v", benchmarkDir + ":/kaniko/benchmarks", "-v", cwd + ":/workspace", "-e", benchmarkEnv, ExecutorImage,