[libvirt PATCH v3 12/12] ci: jobs.sh: Define and create SCRATCH_DIR for local executions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 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
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux