Files
infra-maintenance/.drone.yml
matthiasberner f13bf98102
Some checks failed
continuous-integration/drone/push Build encountered an error
.drone.yml aktualisiert
2026-01-11 14:27:46 +01:00

113 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
kind: secret
name: password_authelia
get:
path: secret/data/authelia/ssh
name: root
---
kind: secret
name: password_matrix
get:
path: secret/data/matrix/bot/drone-bot
name: password
---
kind: secret
name: userid_matrix
get:
path: secret/data/matrix/bot/drone-bot
name: userid
---
kind: secret
name: roomid_matrix
get:
path: secret/data/matrix/bot/drone-bot
name: roomid
---
kind: pipeline
name: authelia_check
trigger:
event:
- pull_request
- push
- custom
- cron
steps:
- name: ssh-check
image: appleboy/drone-ssh
settings:
host: 10.0.4.18
username: root
password:
from_secret: password_authelia
port: 22
envs:
- args
- ARGS
- DRONE_BUILD_EVENT
script: |
export FINAL_ARGS=${args:-${ARGS:-}}
fetch -o /tmp/authelia-update.sh https://git.familie-berner.de/Open/infra-maintenance/raw/branch/main/authelia/authelia-update.sh
chmod +x /tmp/authelia-update.sh
# Wir führen das Script aus und fangen den Exit Code ab
set +e
timeout 10m /tmp/authelia-update.sh $FINAL_ARGS
EXIT_CODE=$?
set -e
# Übersetze Exit-Codes in lesbaren Text für Matrix
case $EXIT_CODE in
0) MSG="✅ Update erfolgreich / Alles aktuell" ;;
10) MSG=" Update verfügbar, aber nicht angewendet (--apply fehlt)" ;;
64) MSG="❌ Fehler: Ungültige Parameter" ;;
69) MSG="🌐 Fehler: Netzwerk/GitHub nicht erreichbar" ;;
70) MSG="📂 Fehler: Authelia Binary nicht gefunden" ;;
72) MSG="↩ Fehler: Kein Backup für Revert gefunden" ;;
75) MSG="🔥 KRITISCH: Dienst startet nicht! (Auto-Revert ggf. aktiv)" ;;
*) MSG="❓ Unbekannter Fehler (Code: $EXIT_CODE)" ;;
esac
echo "STATUS_TEXT=$MSG" > /tmp/drone_result.env
echo "[INFO] Skript beendet mit: $MSG"
# Wir lassen den Step fehlschlagen, wenn Code nicht 0 oder 10 ist
if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 10 ]; then exit $EXIT_CODE; fi
---
kind: pipeline
name: matrix_message
# Diese Pipeline läuft immer nach authelia_apply
depends_on:
- authelia_apply
trigger:
status:
- success
- failure
steps:
- name: notify
image: spotlightkid/drone-matrixchat-notify
settings:
homeserver: 'https://matrix.familie-berner.de'
roomid: { from_secret: roomid_matrix }
userid: { from_secret: userid_matrix }
password: { from_secret: password_matrix }
markdown: 'yes'
template: |
### Authelia Update Bericht
**Status:** ${DRONE_BUILD_STATUS == 'success' ? '✅ Erfolg' : '❌ Fehlgeschlagen'}
**Event:** `${DRONE_BUILD_EVENT}`
**Build:** [#${DRONE_BUILD_NUMBER}](${DRONE_BUILD_LINK})
**Details:**
${DRONE_BUILD_STATUS == 'success' ? 'Das Skript wurde erfolgreich ausgeführt oder es war kein Update nötig.' : 'Ein Fehler ist aufgetreten. Bitte prüfe die Drone-Logs für den Exit-Code.'}
[Protokoll einsehen](${DRONE_BUILD_LINK})