Files
nomad-csi/.gitea/workflows/deploy.yml
Henrik Jess Nielsen edffcd0766 Add idempotent volume provisioning step
Skips example.hcl, creates volumes that don't exist yet.
2026-05-26 23:45:53 +02:00

44 lines
1.1 KiB
YAML

name: Deploy CSI Jobs
on:
push:
branches: [main]
paths:
- 'csi/**'
jobs:
deploy:
runs-on: debian
steps:
- name: Pull latest
run: |
cd /opt/nomad-csi
git pull
- name: Deploy controller
run: |
nomad job run /opt/nomad-csi/csi/controller.nomad
- name: Deploy node plugin
run: |
nomad job run /opt/nomad-csi/csi/node.nomad
- name: Verify CSI plugin healthy
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