From edffcd0766769182bf7b142a59794d2b385e4e22 Mon Sep 17 00:00:00 2001 From: Henrik Jess Nielsen Date: Tue, 26 May 2026 23:45:53 +0200 Subject: [PATCH] Add idempotent volume provisioning step Skips example.hcl, creates volumes that don't exist yet. --- .gitea/workflows/deploy.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 33609a5..edb196d 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -27,3 +27,17 @@ jobs: run: | sleep 10 nomad plugin status org.democratic-csi.nfs + + - name: Provision volumes + run: | + for vol in /opt/nomad-csi/csi/volumes/*.hcl; do + # Skip example/template files + [[ "$vol" == *example* ]] && continue + vol_id=$(grep -Po '(?<=id\s{1,10}=\s{1,10}")[^"]+' "$vol" | head -1) + if nomad volume status "$vol_id" > /dev/null 2>&1; then + echo "Volume $vol_id already exists, skipping" + else + echo "Creating volume $vol_id" + nomad volume create "$vol" + fi + done