# -*- mode: ruby -*- # vi: set ft=ruby : # Copyright (c) 2023 The Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer; # redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution; # neither the name of the copyright holders nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NUM_RUNNERS=0 # Set this to the desired number of runners. PERSONAL_ACCESS_TOKEN="" GITHUB_ORG="" HOSTNAME="" Vagrant.configure("2") do |config| config.ssh.username = "vagrant" config.ssh.password = "vagrant" (1..NUM_RUNNERS).each do |i| config.vm.define "#{HOSTNAME}-#{i}" do |runner| runner.vm.hostname = "#{HOSTNAME}-#{i}" runner.vm.box = "generic/ubuntu2204" runner.vm.box_check_update = true runner.vm.provider "libvirt" do |vb| # Customize the amount of cpus, memory, and storage on the VM: vb.cpus = "4".to_i vb.memory = "16384".to_i vb.machine_virtual_size = 128 # 128G is the minimum. end # sets up vm runner.vm.provision :shell, path: "provision_root.sh" runner.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. runner.vm.provision :reload # Copy the "action-run.sh" script from the host to the VM. runner.vm.provision "file", source: "./action-run.sh", destination: "/tmp/action-run.sh" runner.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. runner.vm.provision :shell, privileged: false, run: 'always', inline: "./action-run.sh #{PERSONAL_ACCESS_TOKEN} #{GITHUB_ORG} >> action-run.log 2>&1 &" end end end