BlueGit

timfa bluegit

Files

bluegit / scripts / self-update.sh

self-update.sh

fix: markeer dode jobs na herstart en verplaats de self-update-poll
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
Passed e5b8fc72 History
self-update.sh 870 B Download Raw
1#!/usr/bin/env bash
2# Start de self-update en stop meteen. POST /api/v1/admin/self-update
3# antwoordt 202 zodra de unit start. De installatie herstart bluegit.service
4# en daarmee Steve. Een job die dan nog loopt, sterft mee.
5# De wacht "self-update ok voor CI_COMMIT_SHA" staat aan het begin van
6# publish_aur (scripts/wait-self-update.sh). Die job heeft
7# needs: [self_update] en draait dus pas nadat deze POST klaar is.
8set -euo pipefail
9
10: "${CI_API_URL:?CI_API_URL ontbreekt}"
11: "${BLUEGIT_UPDATE_TOKEN:?BLUEGIT_UPDATE_TOKEN ontbreekt}"
12: "${CI_COMMIT_SHA:?CI_COMMIT_SHA ontbreekt}"
13
14api="${CI_API_URL%/}/admin/self-update"
15
16curl -fsS --connect-timeout 5 --max-time 20 -X POST "$api" \
17 -H "Authorization: Bearer ${BLUEGIT_UPDATE_TOKEN}" \
18 -H "Content-Type: application/json" \
19 -d "{\"ref\":\"${CI_COMMIT_SHA}\"}"
20
21echo "Self-update gestart: ${CI_COMMIT_SHA}"