GitLab-runner - Fixing ssh access
Here is debug process for this situation.
Verify you can logging to remote ssh server manually
Verify you can logging to remote ssh server manually using same local user and same key file than gitlab-runner
sudo su - USER
eval `ssh-agent -s`
ssh-add YOUR_SSH_KEY_FILE
ssh REMOTEU_SER@REMOTE_SERVER
You should solve any issue here before continue.
Launch gitlab-runner log in debug mode
sudo vi /etc/gitlab-runner/config.toml
Add log_level = "debug"
# Sample
concurrent = 1
check_interval = 0
log_level = "debug"
...
Then restart gitlab-runner
sudo gitlab-runner restart
Retry to run buggy job.
If it does not help go to next step.
Launch remote sshd in debug mode
Run SSH daemon on another port as a part of the command (then you don't need to lost your existing session, if already connect thought ssh)
See how-to debug ssh connection.
Then modify gitlab-runner configuration (on gitlab runner host)
sudo vi /etc/gitlab-runner/config.toml
Add port = "2200"
...
[[runners]]
name = "XXXXX"
url = "https://XXXXX/"
token = "XXXXX"
executor = "ssh"
[runners.ssh]
user = "XXXXX"
host = "XXXXX"
port = "2200"
identity_file = "XXXXX"
...
Retry to run buggy job.
On console sshd console you are able to see all gitlab-runner actions and you should be able to understand what is the issue.