Replace variable-length lookbehind with \K which GNU grep supports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
41 lines
1021 B
YAML
41 lines
1021 B
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
|
|
[[ "$vol" == *example* ]] && continue
|
|
vol_id=$(grep -oP 'id\s*=\s*"\K[^"]+' "$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
|