diff --git a/.drone.yml b/.drone.yml index 3ec4a7d..9f9cb70 100644 --- a/.drone.yml +++ b/.drone.yml @@ -35,72 +35,68 @@ trigger: - push steps: -- name: ssh-check - image: appleboy/drone-ssh - # Hier mappen wir den UI-Parameter 'args' fest auf eine Variable 'MY_ARGS' - environment: - MY_ARGS: - from_env: args - settings: - host: 10.0.4.18 - username: root - password: - from_secret: password_authelia - port: 22 - command_timeout: 10m - # Wir sagen dem Plugin, es soll MY_ARGS mit über SSH nehmen - envs: - - MY_ARGS - - DRONE_BUILD_EVENT - script: | - # Einfache Zuweisung ohne komplexe Syntax, um 'sh' Fehler zu vermeiden - echo "[INFO] Build event: $DRONE_BUILD_EVENT" - echo "[INFO] Inhalt von MY_ARGS: $MY_ARGS" + - name: ssh-check + image: appleboy/drone-ssh + settings: + host: 10.0.4.18 + username: root + password: + from_secret: password_authelia + port: 22 + # Hier liegt der Schlüssel: + # Wir sagen dem Plugin, es soll die Variable 'args' (aus der UI) + # und 'DRONE_BUILD_EVENT' in die SSH-Session exportieren. + envs: + - args + - DRONE_BUILD_EVENT + script: | + # In der SSH-Session ist die Variable nun so verfügbar, + # wie du sie in der UI benannt hast. + echo "[INFO] Event: $DRONE_BUILD_EVENT" + echo "[INFO] Parameter: $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 - - # Skript mit dem Parameter aus MY_ARGS ausführen - timeout 10m /tmp/authelia-update.sh $MY_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 + + # Ausführen. Falls $args leer ist, passiert nichts Schlimmes. + /tmp/authelia-update.sh $args --- kind: pipeline +type: docker name: authelia_apply trigger: event: - custom + - cron steps: -- name: ssh-check - image: appleboy/drone-ssh - # Hier mappen wir den UI-Parameter 'args' fest auf eine Variable 'MY_ARGS' - environment: - MY_ARGS: - from_env: args - settings: - host: 10.0.4.18 - username: root - password: - from_secret: password_authelia - port: 22 - command_timeout: 10m - # Wir sagen dem Plugin, es soll MY_ARGS mit über SSH nehmen - envs: - - MY_ARGS - - DRONE_BUILD_EVENT - script: | - # Einfache Zuweisung ohne komplexe Syntax, um 'sh' Fehler zu vermeiden - echo "[INFO] Build event: $DRONE_BUILD_EVENT" - echo "[INFO] Inhalt von MY_ARGS: $MY_ARGS" + - name: ssh-check + image: appleboy/drone-ssh + settings: + host: 10.0.4.18 + username: root + password: + from_secret: password_authelia + port: 22 + # Hier liegt der Schlüssel: + # Wir sagen dem Plugin, es soll die Variable 'args' (aus der UI) + # und 'DRONE_BUILD_EVENT' in die SSH-Session exportieren. + envs: + - args + - DRONE_BUILD_EVENT + script: | + # In der SSH-Session ist die Variable nun so verfügbar, + # wie du sie in der UI benannt hast. + echo "[INFO] Event: $DRONE_BUILD_EVENT" + echo "[INFO] Parameter: $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 - - # Skript mit dem Parameter aus MY_ARGS ausführen - timeout 10m /tmp/authelia-update.sh $MY_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 + + # Ausführen. Falls $args leer ist, passiert nichts Schlimmes. + /tmp/authelia-update.sh $args --- kind: pipeline