This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Vagrantfile
60 lines (53 loc) · 2.06 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
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/bionic64"
config.vm.network "forwarded_port", guest: 5432, host: 5432
config.vm.network "forwarded_port", guest: 12321, host: 12321
config.vm.provider "virtualbox" do |v|
v.memory = 6144
v.cpus = 2
end
# This runs as root:
config.vm.provision "bootstrap_as_root", type: "shell", path: "scheduler/bin/bootstrap", env: {
"PGPASSWORD" => ENV["PGPASSWORD"],
"GKE_CLUSTER_OWNER" => ENV["USER"],
"GCP_PROJECT_NAME" => ENV["GCP_PROJECT_NAME"]}
# This runs as vagrant:
$script = <<-SCRIPT
repo_root=/vagrant
bashrc=$HOME/.bashrc
# Cook java jobclient setup
cd $repo_root/jobclient/java || exit 1
mvn install -DskipTests
# Python setup
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade wheel
pip3 install --upgrade virtualenv
cd $repo_root || exit 1
venv=$repo_root/venv
rm -rf $venv
$HOME/.local/bin/virtualenv venv --python=python3.6
source $venv/bin/activate
echo "source $venv/bin/activate" | tee -a $bashrc
export PATH=$venv/bin:$PATH
echo 'export PATH='$venv'/bin:$PATH' | tee -a $bashrc
# Integration tests setup
echo "export COOK_TEST_DOCKER_IMAGE=gcr.io/google-containers/alpine-with-bash:1.0" | tee -a $bashrc
echo "export COOK_TEST_DOCKER_WORKING_DIRECTORY=/mnt/sandbox" | tee -a $bashrc
echo "export COOK_TEST_DISALLOW_POOLS_REGEX='(?!^k8s-(alpha)$)'" | tee -a $bashrc
echo "export COOK_TEST_DEFAULT_SUBMIT_POOL=k8s-alpha" | tee -a $bashrc
echo "export COOK_TEST_COMPUTE_CLUSTER_TYPE=kubernetes" | tee -a $bashrc
echo "export COOK_TEST_DEFAULT_TIMEOUT_MS=480000" | tee -a $bashrc
echo "export COOK_TEST_DEFAULT_WAIT_INTERVAL_MS=8000" | tee -a $bashrc
cd $repo_root/integration || exit 1
pip3 install -r requirements.txt
# Cook Scheduler CLI setup
cli=$repo_root/cli
cd $cli || exit 1
pip3 install -e .
rm -f $HOME/.cs.json
ln -s $cli/.cs.json $HOME/.cs.json
sudo service postgresql restart
SCRIPT
config.vm.provision "bootstrap_as_vagrant", type: "shell", inline: $script, privileged: false
end