gitlab-runner with virtualbox ssh failiing
Summary
Using gitlab runner with virtualbox fails as gitlab-runner is unable to connect to the virtual machine usin ssh
Steps to reproduce
- install a gitlab runner with "vitualbox" executor
- add virtualbox image and snapshot
- create a pipeline that uses it
Example Project
https://gitlab.com/moozer/ansible-server-radicale
What is the current bug behavior?
When the pipeline runs I get
Running with gitlab-ci-multi-runner 9.5.1 (96b34cc)
on gitlab-runner-eal-02 vbox (6397f9d3)
Using VirtualBox version 5.2.22_Debianr126257 executor...
Creating new VM...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
Will be retried in 3s ...
It seems that virtualbox does not support connection between the host and the guest, wen the interface is NAT'ed.
What is the expected correct behavior?
gitlab runner spins up a virtualmachine and is able to connect to it.
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)
Results of GitLab application Check
gitlab is functioning correctly.
# vboxmanage --version
5.2.22_Debianr126257
# gitlab-runner -v
Version: 9.5.1
Git revision: 96b34cc
Git branch: 9-5-stable
GO version: go1.8.3
Built: Wed, 04 Oct 2017 16:26:27 +0000
OS/Arch: linux/amd64
Possible fixes
I have been through the installation guide for runners, and the "shell" executor is working.
The documentation for gitlab-runner that I followed is here: https://docs.gitlab.com/runner/executors/virtualbox.html#create-a-new-base-virtual-machine
I have set the first NIC to be NAT'ed as stated.
Virtualbox does not support that connection between host and guest, so ssh connections will fail. This is according to the official documentation (se table 61): https://www.virtualbox.org/manual/ch06.html
From a networking perspective, the host does not have a route to the virtualbox NAT'ed network, and so connecting using SSH is not possible (unless you use a port forward).
Solutions/thoughts:
- There must be an installation step missing in the guide.
- Gitlab-runner has some non-networked way of talking to virtualbox VMs