summaryrefslogtreecommitdiffstats
path: root/jjb/kuberef/Vagrantfile
diff options
context:
space:
mode:
authorVictor Morales <v.morales@samsung.com>2020-08-28 16:35:12 -0400
committerVictor Morales <v.morales@samsung.com>2020-08-28 17:17:01 -0400
commit6fb97028e93a7844000204be53ed937a47d9082f (patch)
tree4f6c8936d7205a1ea512f350bd79c6a57cee4487 /jjb/kuberef/Vagrantfile
parent857de0535fcac0b353cc7f3c555060aa5807cfc7 (diff)
Improve kuberef lint script
The OPNFV security audit releng's job prevent to retrieve binaries from external sources which results on depending to the binaries provided by the OS package managers. This change pretends to cover different scenarios where the Jenkins builder is unknown. Signed-off-by: Victor Morales <v.morales@samsung.com> Change-Id: I37d9b15d3ac9de0b06a96e07eed90f7cc717f444
Diffstat (limited to 'jjb/kuberef/Vagrantfile')
-rw-r--r--jjb/kuberef/Vagrantfile70
1 files changed, 70 insertions, 0 deletions
diff --git a/jjb/kuberef/Vagrantfile b/jjb/kuberef/Vagrantfile
new file mode 100644
index 000000000..61132f57b
--- /dev/null
+++ b/jjb/kuberef/Vagrantfile
@@ -0,0 +1,70 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+##############################################################################
+# Copyright (c) 2020 Samsung Electronics
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+$no_proxy = ENV['NO_PROXY'] || ENV['no_proxy'] || "127.0.0.1,localhost"
+# NOTE: This range is based on vagrant-libvirt network definition CIDR 192.168.121.0/24
+(1..254).each do |i|
+ $no_proxy += ",192.168.121.#{i}"
+end
+$no_proxy += ",10.0.2.15"
+
+distros = {
+"centos_7" => "generic/centos7",
+"ubuntu_xenial" => "generic/ubuntu1604",
+"ubuntu_bionic" => "generic/ubuntu1804",
+"ubuntu_focal" => "generic/ubuntu2004",
+"opensuse" => "opensuse/Tumbleweed.x86_64"
+}
+
+Vagrant.configure("2") do |config|
+ config.vm.provider :libvirt
+ config.vm.provider :virtualbox
+
+ config.vm.synced_folder './', '/vagrant', type: "rsync",
+ rsync__args: ["--verbose", "--archive", "--delete", "-z"]
+ distros.each do |key,box|
+ config.vm.define key do |node|
+ node.vm.box = box
+ node.vm.box_check_update = false
+ end
+ end
+
+ config.vm.provision 'shell', privileged: false, inline: <<-SHELL
+ set -o errexit
+
+ cd /vagrant
+ ./kuberef-run-linting.sh
+ SHELL
+
+ [:virtualbox, :libvirt].each do |provider|
+ config.vm.provider provider do |p|
+ p.cpus = 1
+ p.memory = ENV['MEMORY'] || 512
+ end
+ end
+
+ config.vm.provider "virtualbox" do |v|
+ v.gui = false
+ end
+
+ config.vm.provider :libvirt do |v|
+ v.random_hostname = true
+ v.management_network_address = "192.168.121.0/24"
+ end
+
+ if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
+ if Vagrant.has_plugin?('vagrant-proxyconf')
+ config.proxy.http = ENV['http_proxy'] || ENV['HTTP_PROXY'] || ""
+ config.proxy.https = ENV['https_proxy'] || ENV['HTTPS_PROXY'] || ""
+ config.proxy.no_proxy = $no_proxy
+ config.proxy.enabled = { docker: false, git: false }
+ end
+ end
+end