.drone.yml hinzugefügt
Some checks failed
continuous-integration/drone/push Build encountered an error
Some checks failed
continuous-integration/drone/push Build encountered an error
This commit is contained in:
179
.drone.yml
Normal file
179
.drone.yml
Normal file
@@ -0,0 +1,179 @@
|
||||
---
|
||||
# ============================================================================
|
||||
# .drone.yml — Infra Maintenance (Authelia Update via Bastille/Jail)
|
||||
#
|
||||
# Ziel:
|
||||
# - Authelia Update-Script im Authelia-Jail nativ ausführen (kein Docker)
|
||||
# - Secrets (SSH + Matrix) aus Vault ziehen
|
||||
# - Exit-Codes sauber an Drone übergeben (für Auswertung/Benachrichtigung)
|
||||
# - Matrix-Benachrichtigung bei Erfolg/Fehler (inkl. Check-Only vs Apply)
|
||||
#
|
||||
# Architektur:
|
||||
# - Drone Pipeline type: ssh
|
||||
# -> verbindet sich auf den FreeBSD Host (XigmaNAS/FreeBSD)
|
||||
# -> führt dort "bastille cmd authelia ..." aus
|
||||
# -> damit läuft alles im echten Jail mit echtem service(8)
|
||||
#
|
||||
# Voraussetzungen:
|
||||
# - Authelia-Jail heißt: authelia (ggf. anpassen)
|
||||
# - Script liegt IM Jail unter: /root/authelia-update.sh (ggf. anpassen)
|
||||
# - Bastille ist auf dem Host vorhanden und korrekt konfiguriert
|
||||
# - Drone Vault Secret-Plugin ist aktiv (dein Setup)
|
||||
# - Matrix Bot Credentials in Vault vorhanden (siehe Secrets unten)
|
||||
#
|
||||
# Trigger-Konzept (empfohlen):
|
||||
# - event: cron -> check-only (kein apply), Exit 0 oder 10 etc.
|
||||
# - event: manual -> apply + auto-revert
|
||||
#
|
||||
# Hinweis:
|
||||
# - Der Matrix-Notify Step läuft in einem Container (Spotlightkid Plugin).
|
||||
# Das ist OK, weil es nur HTTP Richtung Matrix macht und keine System-
|
||||
# Operationen auf FreeBSD ausführt.
|
||||
# ============================================================================
|
||||
|
||||
# -----------------------------
|
||||
# SSH Secrets aus Vault (Host)
|
||||
# -----------------------------
|
||||
---
|
||||
kind: secret
|
||||
name: username_docker
|
||||
get:
|
||||
path: secret/data/docker/ssh
|
||||
name: username
|
||||
---
|
||||
kind: secret
|
||||
name: password_docker
|
||||
get:
|
||||
path: secret/data/docker/ssh
|
||||
name: password
|
||||
|
||||
# ----------------------------------------
|
||||
# Matrix Bot Secrets aus Vault (Notify)
|
||||
# ----------------------------------------
|
||||
---
|
||||
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
|
||||
|
||||
# ============================================================
|
||||
# Pipeline 1: Authelia CHECK (kein apply)
|
||||
# - Läuft z. B. per Drone Cron
|
||||
# - Führt das Script ohne Flags aus => nur prüfen
|
||||
# ============================================================
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: authelia_check
|
||||
|
||||
server:
|
||||
host: 172.16.1.53
|
||||
user:
|
||||
from_secret: username_docker
|
||||
password:
|
||||
from_secret: password_docker
|
||||
|
||||
clone:
|
||||
depth: 50
|
||||
|
||||
steps:
|
||||
- name: check_authelia_update
|
||||
commands:
|
||||
# Script läuft im Jail, nativ, keine Containerisierung
|
||||
# Check-only: KEIN --apply
|
||||
- timeout 5m bastille cmd authelia /root/authelia-update.sh
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- cron
|
||||
|
||||
# ============================================================
|
||||
# Pipeline 2: Authelia APPLY (Update + auto-revert)
|
||||
# - Läuft bewusst per "manual" Trigger
|
||||
# - Führt Update durch und nutzt Auto-Revert bei Fehlstart
|
||||
# ============================================================
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: authelia_apply
|
||||
|
||||
server:
|
||||
host: 172.16.1.53
|
||||
user:
|
||||
from_secret: username_docker
|
||||
password:
|
||||
from_secret: password_docker
|
||||
|
||||
clone:
|
||||
depth: 50
|
||||
|
||||
steps:
|
||||
- name: apply_authelia_update
|
||||
commands:
|
||||
# Apply + auto-revert (Rollback falls Dienst nach Update nicht sauber läuft)
|
||||
- timeout 10m bastille cmd authelia /root/authelia-update.sh --apply --auto-revert
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- manual
|
||||
|
||||
# ============================================================
|
||||
# Pipeline 3: Matrix Notify (Erfolg/Fehler)
|
||||
# - Läuft nach authelia_check UND authelia_apply
|
||||
# - Sendet Status, Build-Infos, Commit-Link
|
||||
# ============================================================
|
||||
---
|
||||
kind: pipeline
|
||||
name: matrix_message
|
||||
|
||||
depends_on:
|
||||
- authelia_check
|
||||
- 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**
|
||||
repo: `${DRONE_REPO}`
|
||||
branch: `${DRONE_BRANCH}`
|
||||
build: `#${DRONE_BUILD_NUMBER}`
|
||||
status: **${DRONE_BUILD_STATUS}**
|
||||
|
||||
event: `${DRONE_BUILD_EVENT}`
|
||||
commit: ${DRONE_COMMIT_LINK}
|
||||
|
||||
pr: `${DRONE_PULL_REQUEST}`
|
||||
${DRONE_PULL_REQUEST_TITLE}
|
||||
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
- main
|
||||
Reference in New Issue
Block a user