]> xenbits.xensource.com Git - libvirt.git/commitdiff
ci: jobs.sh: Define and create SCRATCH_DIR for local executions
authorErik Skultety <eskultet@redhat.com>
Wed, 13 Sep 2023 09:49:09 +0000 (11:49 +0200)
committerErik Skultety <eskultet@redhat.com>
Tue, 19 Sep 2023 11:35:59 +0000 (13:35 +0200)
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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ci/jobs.sh

index 2e6888232f4f2cab94641096e6c5be18c25ca071..ba522258a14db837d20017d5620621f5870497f0 100644 (file)
@@ -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