From 4096a59e6e450fae40a546487722709e447bbd47 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Wed, 13 Sep 2023 11:49:09 +0200 Subject: [PATCH] ci: jobs.sh: Define and create SCRATCH_DIR for local executions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Running outside of GitLab will likely not have the variable set and hence the execution would fail. To make sure we always start with a clean scratch dir (which may or may not be the best thing), create it with 'mktemp'. The main reason for a temporary directory is to ensure a clean environment for the job every time run_integration function is run. For repeated interactive use case, it is imperative that the developer takes care of their environment. Signed-off-by: Erik Skultety Reviewed-by: Daniel P. Berrangé --- ci/jobs.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/jobs.sh b/ci/jobs.sh index 2e6888232f..ba522258a1 100644 --- a/ci/jobs.sh +++ b/ci/jobs.sh @@ -122,6 +122,13 @@ run_integration() { # should also be a non-fatal error run_cmd_quiet sudo virsh --quiet net-start default || true + # SCRATCH_DIR is normally set inside the GitLab CI job to /tmp/scratch. + # However, for local executions inside a VM we need to make sure some + # scratch directory exists and also that it is created outside of /tmp for + # storage space reasons (if multiple project repos are to be cloned). + SCRATCH_DIR="${SCRATCH_DIR:=$GIT_ROOT/ci/scratch)}" + + test ! -d "$SCRATCH_DIR" && run_cmd mkdir "$SCRATCH_DIR" run_cmd cd "$SCRATCH_DIR" run_cmd git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git run_cmd cd libvirt-tck