[libvirt PATCH 7/7] ci: integration.sh: Define the SCRATCH_DIR variable for local execution

Martin Kletzander mkletzan at redhat.com
Mon Jan 23 08:41:10 UTC 2023


On Fri, Jan 20, 2023 at 04:06:03PM +0100, Erik Skultety wrote:
>Running outside of GitLab will likely not have the variable set and
>hence the execution would fail.
>
>Signed-off-by: Erik Skultety <eskultet at redhat.com>
>---
> ci/integration.sh | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/ci/integration.sh b/ci/integration.sh
>index 41326d6e40..ac04c46d8e 100644
>--- a/ci/integration.sh
>+++ b/ci/integration.sh
>@@ -37,6 +37,14 @@ virsh net-start default &>/dev/null || true
> # END AS ROOT
> exit
>
>+# If we're running outside of GitLab, this variable will likely not exist, so
>+# we need to define it and create the scratch directory
>+if [ -z "$SCRATCH_DIR" ]
>+then
>+    SCRATCH_DIR="/tmp/scratch"
>+    mkdir "$SCRATCH_DIR" 2>/dev/null

This could fail if someone has this directory already.  Which is a good
thing as otherwise it could override some of it.  But wouldn't it be
nicer to use mktemp -d and print the result?

>+fi
>+
> cd "$SCRATCH_DIR"
> git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git
> cd libvirt-tck
>-- 
>2.39.0
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230123/42c3e75d/attachment.sig>


More information about the libvir-list mailing list