Configure GitLab Runner to use beaker-vagrant with libvirt
This guide will assume you already have a gitlab-runner set up and configured.
Requirements:
GitLab runner lives on a host that can provision VMs via vagrant.
The GitLab runner has a valid SSH key to use to SSH onto the vagrant provisioned VM’s.
The Gitlab runner has the beaker-vagrant rubygem installed.
The beaker-vagrant libvirt file should be patched (/home/gitlab-runner/.rvm/gems/ruby-2.5.7/gems/beaker-vagrant-0.6.6/lib/beaker/hypervisor/vagrant_libvirt.rb) as described in Make beaker work with libvirt instead of virtualbox .
You have to be able to log into the project’s GitLab Administrator’s panel to change the project’s secret variables in the CI/CD section.
Ruby 2.5.7 is established as the default as per the SIMP development environment guidelines at the time of writing this, and therefore you should ensure at the bare minimum the rvm has ruby-2.5.7 installed.
Instructions
As an administrator who is logged into the GitLab website (Go to Settings → CI/CD)
Add the following secret variable: BEAKER_HYPERVISOR='vagrant_libvirt'
Add the following secret variable: VAGRANT_DEFAULT_PROVIDER=libvirt