From 253086a9024b185c37d587dd40bafaf1efb68654 Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 4 Feb 2026 14:21:50 +0100 Subject: [PATCH] Add loop for host key lookup --- webhooks-git/entrypoint.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/webhooks-git/entrypoint.sh b/webhooks-git/entrypoint.sh index 0c84643..6b99405 100644 --- a/webhooks-git/entrypoint.sh +++ b/webhooks-git/entrypoint.sh @@ -59,7 +59,20 @@ fi # Create or append known_hosts echo "Validating: $GIT_SERVER_DADI_STAGING" -ssh-keyscan -H "$GIT_SERVER_DADI_STAGING" >>"${path_ssh}"/known_hosts +# Wir wollen, dass der Befehl mindestens einmal erfolgreich ist. +# Wenn er scheitert, warten wir 10 s und probieren es erneut. +while true; do + # Versuche, den Host‑Key zu holen und an known_hosts anzuhängen. + # Der Rückgabewert von ssh-keyscan ist 0, wenn mindestens ein + # Schlüssel empfangen wurde. + if ssh-keyscan -H "$GIT_SERVER_DADI_STAGING" >>"${path_ssh}/known_hosts"; then + echo "✅ Host key for '$GIT_SERVER_DADI_STAGING' added to known_hosts" + break # Erfolg → Schleife verlassen + else + echo "⚠️ ssh-keyscan failed – retry in 10 seconds" + sleep 10 + fi +done echo "git and ssh configured." echo "|--- dadi staging webhook public key (deploy key): --------------------|"