I am trying to setup a VM-based set of runners with clean environment on for job. Just like virtualbox runner, but I have two dedicated self-hosted machines both running proxmox which uses KVM.
I have multiple VMs setup; a manager VM (the one that the runners are registered on) and multiple other VMs for each platform, each one updated and setup with some basic packages installed and then snapshot.
VMs screenshot and runner configs
Config script: https://hastebin.app/5e7246363f5e83001c1b9692
Prepare script: https://hastebin.app/5e7245933f5e83001c1b968f
Cleanup script: https://hastebin.app/raw/5e7245c23f5e83001c1b9690
Sample runner config.toml: https://hastebin.app/5e7246253f5e83001c1b9691
Current VS expected
- VM runner0.gitlab.domain.tld is the runner manager VM
- bold text is the one that is different
Current CI flow
- pipeline is triggered
- job is assigned to a runnerX on VM runner0.gitlab.domain.tld
- script “config.sh” is run on runner0 (sets the variables)
- script prepare.sh is run on runner0
- ssh to vm host box
- force-stop runnerX vm
- rollback runnerX vm to snapshot “mainRunner”
- startup runnerX vm
- wait until able to SSH to runnerX
- gitlab-runner on runner0 downloads artifacts, cache, git codebase
- gitlab-runner on runner0 runs the .gitlab-ci.yml scripts
- script “cleanup.sh” is run on runner0
Needed CI flow
- pipeline is triggered
- job is assigned to a runnerX on VM runner0.gitlab.domain.tld
- script “config.sh” is run on runnerX (sets the variables)
- script prepare.sh is run on runner0
- ssh to vm host box
- force-stop runnerX vm
- rollback runnerX vm to snapshot “mainRunner”
- startup runnerX vm
- wait until able to SSH to runnerX
- gitlab-runner on runnerX downloads artifacts, cache, git codebase
- gitlab-runner on runnerX runs the .gitlab-ci.yml scripts
- script “cleanup.sh” is run on runner0
What I need is somewhat like the SSH runner, but with “prepare script” added. I don’t even need the config and cleanup script. I would only need the prepare one.
Extra details:
- Using KVM/qemu for virtualization (proxmox to be mroe specific)
- I am using selfhosted gitlab-ce (12.8.6 5fc76a64537)
Thank you in advance for any reply and your time for reading this.