Add idempotent volume provisioning step
Skips example.hcl, creates volumes that don't exist yet.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user