Add loop for host key lookup

main
Andre 2026-02-04 14:21:50 +01:00
parent 96f7d7bf7b
commit 253086a902
1 changed files with 14 additions and 1 deletions

View File

@ -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 10s und probieren es erneut.
while true; do
# Versuche, den HostKey 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 10seconds"
sleep 10
fi
done
echo "git and ssh configured."
echo "|--- dadi staging webhook public key (deploy key): --------------------|"