| 1 | #!/usr/bin/env bash |
| 2 | # Start de self-update en stop meteen, groen. POST /api/v1/admin/self-update |
| 3 | # antwoordt 202 zodra de unit start. publish_aur is dan al klaar |
| 4 | # (needs: [publish_aur], allow_failure). Er is geen poll: een wachtende |
| 5 | # job sterft mee als post_upgrade bluegit.service herstart, en de updater |
| 6 | # zou op die job blijven wachten. |
| 7 | set -euo pipefail |
| 8 | |
| 9 | : "${CI_API_URL:?CI_API_URL ontbreekt}" |
| 10 | : "${BLUEGIT_UPDATE_TOKEN:?BLUEGIT_UPDATE_TOKEN ontbreekt}" |
| 11 | : "${CI_COMMIT_SHA:?CI_COMMIT_SHA ontbreekt}" |
| 12 | |
| 13 | api="${CI_API_URL%/}/admin/self-update" |
| 14 | |
| 15 | curl -fsS --connect-timeout 5 --max-time 20 -X POST "$api" \ |
| 16 | -H "Authorization: Bearer ${BLUEGIT_UPDATE_TOKEN}" \ |
| 17 | -H "Content-Type: application/json" \ |
| 18 | -d "{\"ref\":\"${CI_COMMIT_SHA}\"}" |
| 19 | |
| 20 | echo "Self-update gestart: ${CI_COMMIT_SHA}" |