Files
gem5/util/github-runners-vagrant/Vagrantfile
Bobby R. Bruce c0cb16ba89 util: Create HOSTNAME variable
Change-Id: Ia68f1bef2bb9e4e5e18476b6100be80f8cf1c799
2023-10-06 15:53:57 -07:00

34 lines
1.3 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
PERSONAL_ACCESS_TOKEN="<PERSONAL ACCESS TOKEN>"
GITHUB_ORG="<GITHUB_ORG>"
HOSTNAME="<VM NAME>"
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2204"
config.vm.box_check_update = true
config.vm.define "#{HOSTNAME}"
config.vm.hostname = "#{HOSTNAME}"
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.vm.provider "libvirt" do |vb|
# Customize the amount of cpus and memory on the VM:
vb.cpus = "4".to_i
vb.memory = "16384".to_i
end
# sets up vm
config.vm.provision :shell, path: "provision_root.sh"
config.vm.provision :shell, privileged: false, path: "provision_nonroot.sh"
# The provision_root.sh adds the vagrant user to the docker group, so we need to reload the VM.
config.vm.provision :reload
# Copy the "action-run.sh" script from the host to the VM.
builder.vm.provision "file", source: "./action-run.sh", destination: "/tmp/action-run.sh"
builder.vm.provision :shell, privileged: false, inline: "cp /tmp/action-run.sh ."
# Execute the actions-run.sh script on every boot. This configures the and starts the runner.
config.vm.provision :shell, privileged: false, run: 'always', inline: "./action-run.sh #{PERSONAL_ACCESS_TOKEN} #{GITHUB_ORG} >> action-run.log 2>&1 &"
end