blob: 3df687a96f72620a8296727c5d7564e4fdac8054 [file] [log] [blame]
Pawel Wieczorek09a63572019-12-17 15:33:06 +01001# -*- mode: ruby -*-
2# -*- coding: utf-8 -*-
3
Bartek Grzybowskic0170902021-07-13 13:02:07 +02004nameserver = "8.8.8.8"
Pawel Wieczorek9ee12582020-01-07 15:26:52 +01005synced_folder = "/vagrant"
Pawel Wieczorek049202b2020-01-07 15:28:54 +01006houndd_bin = "${HOME}/go/bin/houndd"
7houndd_config = "${HOME}/config.json"
Pawel Wieczorek8c7373d2020-01-07 15:28:55 +01008onap_git = "git.onap.org"
Pawel Wieczorek09a63572019-12-17 15:33:06 +01009
10$replace_dns = <<-SCRIPT
Bartek Grzybowskic0170902021-07-13 13:02:07 +020011 ns="$1"
12 # persist resolver settings
13 sed -i "s/addresses:.*/addresses: [${ns}]/" /etc/netplan/01-netcfg.yaml
14 # setup resolver for current boot session
15 resolvectl dns eth0 ${ns}
Pawel Wieczorek09a63572019-12-17 15:33:06 +010016SCRIPT
17
18Vagrant.configure("2") do |config|
Bartek Grzybowski98118d82021-07-01 13:37:34 +020019 config.vm.box = "generic/ubuntu2004"
Pawel Wieczorek9ee12582020-01-07 15:26:52 +010020 config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile"
Pawel Wieczorek049202b2020-01-07 15:28:54 +010021 config.vm.network "forwarded_port", guest: 6080, host: 6080
Bartek Grzybowskic0170902021-07-13 13:02:07 +020022 config.vm.provision "replace_dns", type: :shell, inline: $replace_dns, args: nameserver
Pawel Wieczorek09a63572019-12-17 15:33:06 +010023 config.vm.provision "dependencies", type: :shell, inline: <<-SHELL
24 export DEBIAN_FRONTEND=noninteractive
25 apt-get update
Pawel Wieczorek049202b2020-01-07 15:28:54 +010026 apt-get install --assume-yes --quiet golang tmux
Pawel Wieczorek09a63572019-12-17 15:33:06 +010027 SHELL
28 config.vm.provision "binaries", type: :shell, privileged: false, inline: <<-SHELL
29 export GOPATH="${HOME}/go"
30 go get -u github.com/hound-search/hound/cmds/...
31 SHELL
Pawel Wieczorek8c7373d2020-01-07 15:28:55 +010032 config.vm.provision "generate_config", type: :shell do |s|
33 s.privileged = false
Bartek Grzybowski1663d8c2021-07-12 13:57:23 +020034 s.inline = "python3 #{synced_folder}/create_config.py --git ${1} > #{houndd_config}"
35 s.args = [onap_git]
Pawel Wieczorek8c7373d2020-01-07 15:28:55 +010036 end
Pawel Wieczorek049202b2020-01-07 15:28:54 +010037 config.vm.provision "run_codesearch", type: :shell, privileged: false, inline: <<-SHELL
38 tmux new -d -s codesearch #{houndd_bin} -conf #{houndd_config}
Pawel Wieczorek9ee12582020-01-07 15:26:52 +010039 SHELL
Pawel Wieczorek09a63572019-12-17 15:33:06 +010040end