At gitlab.com CI console I see the same output than that of running gitlab-runner run locally on my droplet.
I’m at a loss here. I don’t know how to debug this. I’ve used this setup in the past without trouble.
This config is commented out. Is that intentional?
If it is actually used, suggest editing and verifying that all SSH key entries match the relevant IP/Hosts. Sometimes, domains/IPs change, thus leading to errors. Could also be that someone malicious plays man-in-the-middle, pretending to be the target host with faked DNS resolval.
It would be interesting to see job output and where exactly you get that error. GitLab Runner running on the same machine where you deploy should not SSH to any other host. I suppose you just copy files around?
By default it comes without that section. I added it then commented it out. The effect is the same.
I understand the security implications, I assume it’s using the default now.
The complete log is:
Running with gitlab-runner 16.2.0 (782e15da)
on mpm-sapp-01 PMGVbwn7z, system ID: s_bd8db0f11468
Preparing the "ssh" executor
Using SSH executor...
ERROR: Preparation failed: ssh command Connect() error: ssh Dial() error: ssh: handshake failed: knownhosts: key mismatch
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: ssh command Connect() error: ssh Dial() error: ssh: handshake failed: knownhosts: key mismatch
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: ssh command Connect() error: ssh Dial() error: ssh: handshake failed: knownhosts: key mismatch
Will be retried in 3s ...
ERROR: Job failed (system failure): ssh command Connect() error: ssh Dial() error: ssh: handshake failed: knownhosts: key mismatch
Can you share the GitLab CI/CD configuration that matches the shown error log?
The docs mention that the SSH executor does not support all features, and recommend other types. Maybe the config unveils a problem.
An alternative approach could be using the shell executor, and connecting to the remote host inside the CI/CD config. SSH keys etc. can be passed as variables. Using SSH keys with GitLab CI/CD | GitLab This is a common scenario on GitLab.com SaaS shared runners where users cannot modify the executor type.
Ah, I looked at the config.toml again and you are SSHing to a remote host. Well, then it’s fairly easy. I’d say the Host key for the server changed (for whatever reason, double check this! Just to be sure there is no bad guys doing bad things). So you need to fix that in SSH’s known_hosts file. Delete the incorrect line and run ssh-keyscan remote_host to save the new key.