BlueGit

timfa bluegit

Files

bluegit / scripts / self-update.sh

self-update.sh

fix: publiceer de AUR vóór de self-update
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
Passed dd3381a5 History
self-update.sh 789 B Download Raw
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.
7set -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
13api="${CI_API_URL%/}/admin/self-update"
14
15curl -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
20echo "Self-update gestart: ${CI_COMMIT_SHA}"