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.
This commit is contained in:
parent
d9055df304
commit
48f9968e5b
|
|
@ -17,5 +17,5 @@ set -ex
|
||||||
script_name=$0
|
script_name=$0
|
||||||
script_full_path=$(dirname "$0")
|
script_full_path=$(dirname "$0")
|
||||||
export BENCHMARK=true
|
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
|
./${script_full_path}/integration-test.sh
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
|
@ -188,9 +189,12 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
|
||||||
}
|
}
|
||||||
|
|
||||||
benchmarkEnv := "BENCHMARK_FILE=false"
|
benchmarkEnv := "BENCHMARK_FILE=false"
|
||||||
|
benchmarkDir, err := ioutil.TempDir("", "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if b, err := strconv.ParseBool(os.Getenv("BENCHMARK")); err == nil && b {
|
if b, err := strconv.ParseBool(os.Getenv("BENCHMARK")); err == nil && b {
|
||||||
os.Mkdir("benchmarks", 0755)
|
benchmarkEnv = "BENCHMARK_FILE=/kaniko/benchmarks/" + dockerfile
|
||||||
benchmarkEnv = "BENCHMARK_FILE=/workspace/benchmarks/" + dockerfile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build kaniko image
|
// build kaniko image
|
||||||
|
|
@ -199,6 +203,7 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
|
||||||
kanikoCmd := exec.Command("docker",
|
kanikoCmd := exec.Command("docker",
|
||||||
append([]string{"run",
|
append([]string{"run",
|
||||||
"-v", os.Getenv("HOME") + "/.config/gcloud:/root/.config/gcloud",
|
"-v", os.Getenv("HOME") + "/.config/gcloud:/root/.config/gcloud",
|
||||||
|
"-v", benchmarkDir + ":/kaniko/benchmarks",
|
||||||
"-v", cwd + ":/workspace",
|
"-v", cwd + ":/workspace",
|
||||||
"-e", benchmarkEnv,
|
"-e", benchmarkEnv,
|
||||||
ExecutorImage,
|
ExecutorImage,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue