mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-08-16 11:20:10 +02:00
buildserver: support optionally using qemu+kvm
This makes it possible to run the full build process in a KVM virtual machine, like jenkins.debian.net. closes #190
This commit is contained in:
parent
5af53238d3
commit
0ae2df6646
20
buildserver/Vagrantfile
vendored
20
buildserver/Vagrantfile
vendored
@ -15,11 +15,29 @@ Vagrant.configure("2") do |config|
|
|||||||
config.vm.box = configfile['basebox']
|
config.vm.box = configfile['basebox']
|
||||||
config.vm.box_url = configfile['baseboxurl']
|
config.vm.box_url = configfile['baseboxurl']
|
||||||
|
|
||||||
|
# TODO detect if jessie64.box is libvirt, or `vagrant mutate jessie64 libvirt`
|
||||||
|
if `systemd-detect-virt`.include? "qemu" or configfile["vm_provider"] == "libvirt"
|
||||||
|
# use KVM/QEMU if this is running in KVM/QEMU
|
||||||
|
config.vm.provider :libvirt do |libvirt|
|
||||||
|
libvirt.driver = "kvm"
|
||||||
|
libvirt.host = "localhost"
|
||||||
|
libvirt.uri = "qemu:///system"
|
||||||
|
libvirt.cpus = configfile["cpus"]
|
||||||
|
libvirt.memory = configfile["memory"]
|
||||||
|
end
|
||||||
|
config.vm.synced_folder './', '/vagrant', type: '9p'
|
||||||
|
synced_folder_type = '9p'
|
||||||
|
elsif not configfile.has_key? "vm_provider" or configfile["vm_provider"] == "virtualbox"
|
||||||
|
# default to VirtualBox if not set
|
||||||
config.vm.provider "virtualbox" do |v|
|
config.vm.provider "virtualbox" do |v|
|
||||||
v.customize ["modifyvm", :id, "--memory", configfile['memory']]
|
v.customize ["modifyvm", :id, "--memory", configfile['memory']]
|
||||||
v.customize ["modifyvm", :id, "--cpus", configfile['cpus']]
|
v.customize ["modifyvm", :id, "--cpus", configfile['cpus']]
|
||||||
v.customize ["modifyvm", :id, "--hwvirtex", configfile['hwvirtex']]
|
v.customize ["modifyvm", :id, "--hwvirtex", configfile['hwvirtex']]
|
||||||
end
|
end
|
||||||
|
synced_folder_type = 'virtualbox'
|
||||||
|
else
|
||||||
|
abort("No supported VM Provider found, set vm_provider in Vagrantfile.yaml!")
|
||||||
|
end
|
||||||
|
|
||||||
config.vm.boot_timeout = configfile['boot_timeout']
|
config.vm.boot_timeout = configfile['boot_timeout']
|
||||||
|
|
||||||
@ -32,7 +50,7 @@ Vagrant.configure("2") do |config|
|
|||||||
# default does not need a custom mount
|
# default does not need a custom mount
|
||||||
if configfile["cachedir"] != "buildserver/cache"
|
if configfile["cachedir"] != "buildserver/cache"
|
||||||
config.vm.synced_folder configfile["cachedir"], '/vagrant/cache',
|
config.vm.synced_folder configfile["cachedir"], '/vagrant/cache',
|
||||||
owner: 'root', group: 'root', create: true
|
create: true, type: synced_folder_type
|
||||||
end
|
end
|
||||||
|
|
||||||
# cache .deb packages on the host via a mount trick
|
# cache .deb packages on the host via a mount trick
|
||||||
|
Loading…
Reference in New Issue
Block a user