Automate immutable production deployments
Test and publish container images / test (push) Successful in 2m43s
Test and publish container images / publish (push) Successful in 2m56s

This commit is contained in:
BuTzZ
2026-07-29 13:00:50 +02:00
parent 2e84f4eae4
commit 2064570913
34 changed files with 1779 additions and 215 deletions
+17 -6
View File
@@ -11,25 +11,36 @@ wm_local_die() {
exit 1
}
wm_local_iac_command() {
if command -v tofu >/dev/null 2>&1; then
command -v tofu
elif command -v terraform >/dev/null 2>&1; then
command -v terraform
else
return 1
fi
}
wm_local_resolve_ssh() {
local requested_server="${1:-}"
local requested_identity="${2:-}"
local iac_command
WM_SERVER_IPV4="${requested_server:-${WATERMAPS_SERVER_IPV4:-}}"
if [[ -z "$WM_SERVER_IPV4" ]]; then
command -v tofu >/dev/null 2>&1 ||
wm_local_die "OpenTofu fehlt und WATERMAPS_SERVER_IPV4 wurde nicht gesetzt."
iac_command="$(wm_local_iac_command)" ||
wm_local_die "OpenTofu/Terraform fehlt und WATERMAPS_SERVER_IPV4 wurde nicht gesetzt."
[[ -d "$WM_LOCAL_INFRA_DIR" ]] ||
wm_local_die "OpenTofu-Verzeichnis fehlt: $WM_LOCAL_INFRA_DIR"
WM_SERVER_IPV4="$(tofu -chdir="$WM_LOCAL_INFRA_DIR" output -raw server_ipv4)"
WM_SERVER_IPV4="$("$iac_command" -chdir="$WM_LOCAL_INFRA_DIR" output -raw server_ipv4)"
fi
[[ "$WM_SERVER_IPV4" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] ||
wm_local_die "Ungültige Server-IPv4: $WM_SERVER_IPV4"
WM_SSH_IDENTITY="${requested_identity:-${WATERMAPS_SSH_KEY:-}}"
if [[ -z "$WM_SSH_IDENTITY" ]] && command -v tofu >/dev/null 2>&1 && [[ -d "$WM_LOCAL_INFRA_DIR" ]]; then
candidate_identity="$(tofu -chdir="$WM_LOCAL_INFRA_DIR" output -raw ssh_private_key_path 2>/dev/null || true)"
if [[ -n "$candidate_identity" && -f "$candidate_identity" ]]; then
if [[ -z "$WM_SSH_IDENTITY" ]]; then
candidate_identity="$HOME/.ssh/watermaps_deploy_ed25519"
if [[ -f "$candidate_identity" ]]; then
WM_SSH_IDENTITY="$candidate_identity"
fi
fi