forked from 99designs/keyring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
85 lines (67 loc) · 3.26 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Vagrant.configure("2") do |config|
config.vm.define "linux" do |linux|
linux.vm.box = "generic/fedora32"
linux.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = 2048
vb.cpus = 2
# VBoxVGA flickers constantly, use vmsvga instead which doesn't have that problem
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
end
# mount the project into /keyring
linux.vm.synced_folder ".", "/keyring"
# install gnome desktop and auto login
linux.vm.provision "shell", inline: "sudo dnf install -y --exclude='gnome-initial-setup' @gnome-desktop langpacks-en"
linux.vm.provision "shell", inline: <<-SHELL
sudo sed -i -e 's/\\[daemon\\]/\\[daemon\\]\\nAutomaticLoginEnable=True\\nAutomaticLogin=vagrant\\n/' \
/etc/gdm/custom.conf
SHELL
linux.vm.provision "shell", inline: "sudo systemctl set-default graphical.target"
linux.vm.provision "shell", inline: "sudo systemctl isolate graphical.target"
# set the root password - sometimes prompts show up in gnome needing to install software
linux.vm.provision "shell", inline: "echo 'vagrant' | sudo passwd root --stdin"
# install gnome keyring
linux.vm.provision "shell", inline: "sudo dnf install -y gnome-keyring seahorse"
# install kwallet
linux.vm.provision "shell", inline: "sudo dnf install -y kwalletmanager5"
# install pass
linux.vm.provision "shell", inline: "sudo dnf install -y pass"
# install golang
linux.vm.provision "shell", inline: "sudo dnf install -y go"
end
config.vm.define "windows" do |windows|
windows.vm.box = "StefanScherer/windows_10"
windows.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = 2048
vb.cpus = 2
end
# mount the project into c:\keyring
windows.vm.synced_folder ".", "/keyring"
# install chocolately
windows.vm.provision "shell", privileged: true, inline: <<-SHELL
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature disable -n=showDownloadProgress
SHELL
# install golang
windows.vm.provision "shell", privileged: true, inline: "choco install -y git golang"
end
config.vm.post_up_message = <<-MESSAGE
There are 2 vagrant boxes:
- linux
- OS: Fedora 32 with Gnome Desktop
- The keyring directory is mounted at /keyring
- Get a shell with 'vagrant ssh linux'
- When running go test, you'll need to use the GUI to click "Continue" on the prompts
- After provisioning, adjusting the virtualbox GUI window size doesn't cause the resolution to update. A 'vagrant reload linux' solves the problem
- windows
- OS: Windows 10
- The keyring directory is mounted at C:\keyring
- Get a shell by starting PowerShell in the GUI
- You can run commands remotely using 'vagrant winrm -e windows CMD'. You'll need the -e (elevated privileges) if you want to interact with wincred
Automated scripts for running go test on vagrant boxes (run these locally):
- ./bin/go-test-linux - Run tests on Linux
- ./bin/go-test-windows - Run tests on Windows
- ./bin/go-test - Run all tests - locally, linux and windows
MESSAGE
end