fix: add IdentitiesOnly=yes to SSH config for Dagger

This commit is contained in:
Thomas Güttler
2026-06-02 13:20:20 +02:00
parent 6703ffd69b
commit e5c5dc9db8
+4 -8
View File
@@ -27,6 +27,7 @@ Host dagger-engine
HostName $DAGGER_ENGINE_HOST
User dagger
IdentityFile ~/.ssh/dagger_key
IdentitiesOnly yes
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
SSHEOF
@@ -35,10 +36,7 @@ if ! grep -q "Include ~/.ssh/config.dagger" ~/.ssh/config 2>/dev/null; then
echo "Include ~/.ssh/config.dagger" >> ~/.ssh/config
fi
# The docker exec wrapper approach on the server expects we run 'dagger' command there.
# We can use a trick: set _EXPERIMENTAL_DAGGER_RUNNER_HOST to a script that runs ssh.
# But simpler: write a local wrapper script that runs ssh ... dagger.
# Wrapper for remote dagger execution
cat << 'WRAPPER' > /usr/local/bin/dagger-remote
#!/bin/bash
ssh -F ~/.ssh/config.dagger dagger-engine dagger "$@"
@@ -52,13 +50,11 @@ if ! dagger-remote query '{ version }' >/dev/null 2>&1; then
exit 1
fi
# To make 'task' and other steps work, we alias dagger to dagger-remote
# Or we use _EXPERIMENTAL_DAGGER_RUNNER_HOST=ssh://dagger-engine if it worked.
# Since it hung, let's try the alias approach by putting it in PATH.
# Path management
mkdir -p ~/bin
ln -sf /usr/local/bin/dagger-remote ~/bin/dagger
if [ -n "${GITHUB_PATH:-}" ]; then
echo "$HOME/bin" >> "$GITHUB_PATH"
fi
echo "Dagger remote configured via SSH wrapper."
echo "Dagger remote configured successfully."