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 <eskultet(a)redhat.com>
---
ci/jobs.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ci/jobs.sh b/ci/jobs.sh
index e10769527a..6e3d681af1 100644
--- a/ci/jobs.sh
+++ b/ci/jobs.sh
@@ -117,6 +117,13 @@ run_integration() {
# should also be a non-fatal error
run_cmd sudo virsh --quiet net-start default "2>/dev/null 1>&2"
|| 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
--
2.41.0