Files
watermaps/deploy/scripts/rollback.sh
T
BuTzZ c9a20aacd7
Test and publish container images / test (push) Successful in 2m50s
Test and publish container images / publish (push) Failing after 54s
Reorganised deployment scripts and added rollback functionality. Updated documentation and workflow for container image builds.
2026-07-25 12:36:35 +02:00

29 lines
797 B
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
WM_DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=common.sh
source "$WM_DEPLOY_DIR/scripts/common.sh"
if [[ "$(id -u)" -ne 0 ]]; then
wm_die "Dieses Skript muss als root ausgeführt werden."
fi
wm_load_env
revision="${1:-previous}"
deployments_dir="$WATERMAPS_RUNTIME_DIR/deployments"
if [[ "$revision" == "previous" ]]; then
images_file="$deployments_dir/previous.env"
else
[[ "$revision" =~ ^[0-9a-f]{40}$ ]] ||
wm_die "Rollback-Ziel muss 'previous' oder eine vollständige Git-Commit-SHA sein."
images_file="$deployments_dir/$revision.env"
fi
[[ -f "$images_file" ]] ||
wm_die "Gespeichertes Release nicht gefunden: $images_file"
exec "$WM_DEPLOY_DIR/scripts/deploy.sh" --images-file "$images_file"