summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo Ruijing <ruijing.guo@intel.com>2017-11-26 13:31:05 -0500
committerGuo Ruijing <ruijing.guo@intel.com>2017-11-29 15:58:23 -0500
commit26013163411b419fcf60866d61a028c62737e282 (patch)
treeeda942b779fd1424e31c21e49e15d05e77ce10a7
parentcc076fe7ba6bdc7b5298ed7b19a15cad37af0307 (diff)
build vagrant/libvirt box
1. build box based on chef/bento 2. move setup_vagrant to src/vagrant Change-Id: I69dffac9e16435b20975a4c73a2ac37543a8edf5 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
-rwxr-xr-xci/setup_ci.sh11
-rw-r--r--src/vagrant/README.md23
-rwxr-xr-xsrc/vagrant/setup_vagrant.sh (renamed from ci/setup_vagrant.sh)43
-rw-r--r--src/vagrant/update.sh (renamed from ci/update.sh)0
4 files changed, 41 insertions, 36 deletions
diff --git a/ci/setup_ci.sh b/ci/setup_ci.sh
new file mode 100755
index 0000000..f2e352f
--- /dev/null
+++ b/ci/setup_ci.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+echo "Please run it by jenkins account!"
+cat << EOF | sudo tee /etc/sudoers.d/${USER}
+${USER} ALL = (root) NOPASSWD:ALL
+EOF
+sudo apt-get update > /dev/null
+sudo apt install -y qemu-kvm libvirt-bin 2>1 /dev/null
+echo "Plsease reboot/logout to make effective for libvirt group adding"
diff --git a/src/vagrant/README.md b/src/vagrant/README.md
deleted file mode 100644
index ed5f6c6..0000000
--- a/src/vagrant/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-Vagrant
-=======
-
-vagrant is to create kubernetes cluster using kubeadm.
-kubernetes installation by kubeadm can be refered to
-https://kubernetes.io/docs/getting-started-guides/kubeadm
-
-Vagrant Setup
--------------
-
-sudo apt-get install -y virtualbox
-wget --no-check-certificate https://releases.hashicorp.com/vagrant/1.8.6/vagrant_1.8.6_x86_64.deb
-sudo dpkg -i vagrant_1.8.6_x86_64.deb
-
-K8s Setup
----------
-
-vagrant up
-
-K8s Cleanup
------------
-
-vagrant destroy -f
diff --git a/ci/setup_vagrant.sh b/src/vagrant/setup_vagrant.sh
index 1a09ffb..a2ac72f 100755
--- a/ci/setup_vagrant.sh
+++ b/src/vagrant/setup_vagrant.sh
@@ -2,23 +2,36 @@
set -ex
+DIR="$(dirname `readlink -f $0`)"
+
install_packages()
{
cat << EOF | sudo tee /etc/sudoers.d/${USER}
${USER} ALL = (root) NOPASSWD:ALL
EOF
sudo apt-get update -y
- sudo apt-get install -y openssh-server git virtualbox unzip
+ sudo apt-get install -y git unzip
wget https://releases.hashicorp.com/vagrant/1.8.7/vagrant_1.8.7_x86_64.deb
sudo dpkg -i vagrant_1.8.7_x86_64.deb
rm -rf vagrant_1.8.7_x86_64.deb
+
+ sudo apt-get install -y virtualbox
+
+ #refer to https://github.com/vagrant-libvirt/vagrant-libvirt
+ #sudo apt-get build-dep vagrant ruby-libvirt -y
+ sudo apt-get install -y bridge-utils qemu libvirt-bin ebtables dnsmasq
+ sudo apt-get install -y libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
+ vagrant plugin install vagrant-libvirt
+ sudo adduser ${USER} libvirtd
+ sudo service libvirtd restart
}
-build_box() {
- rm -rf ~/'VirtualBox VMs'/ubuntu-16.04-amd64
- rm -rf bento
+install_box_builder()
+{
# Thanks Bento's great effort
# Bento project(https://github.com/chef/bento) is released by Apache 2.0 License
+ cd $DIR
+ rm -rf bento
git clone https://github.com/chef/bento
cd bento; git checkout 05d98910d835b503e7be3d2e4071956f66fbbbc4
cp ../update.sh ubuntu/scripts/
@@ -26,20 +39,24 @@ build_box() {
unzip packer_1.1.2_linux_amd64.zip
cd ubuntu
sed -i 's/"disk_size": "40960"/"disk_size": "409600"/' ubuntu-16.04-amd64.json
+}
+
+build_virtualbox() {
+ cd $DIR/bento/ubuntu
+ rm -rf ~/'VirtualBox VMs'/ubuntu-16.04-amd64
../packer build -var 'headless=true' -only=virtualbox-iso ubuntu-16.04-amd64.json
vagrant box remove -f opnfv/container4nfv --all || true
vagrant box add opnfv/container4nfv ../builds/ubuntu-16.04.virtualbox.box
}
-install_vagrant_libvirt() {
- #refer to https://github.com/vagrant-libvirt/vagrant-libvirt
- #sudo apt-get build-dep vagrant ruby-libvirt -y
- sudo apt-get install -y qemu libvirt-bin ebtables dnsmasq
- sudo apt-get install -y libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
- vagrant plugin install vagrant-libvirt
- sudo adduser ${USER} libvirtd
- sudo service libvirtd restart
+build_kvmbox() {
+ cd $DIR/bento/ubuntu
+ ../packer build -var 'headless=true' -only=qemu ubuntu-16.04-amd64.json
+ vagrant box remove -f opnfv/container4nfv.kvm --all || true
+ vagrant box add opnfv/container4nfv.kvm ../builds/ubuntu-16.04.libvirt.box
}
install_packages
-build_box
+install_box_builder
+build_virtualbox
+build_kvmbox
diff --git a/ci/update.sh b/src/vagrant/update.sh
index 18752b9..18752b9 100644
--- a/ci/update.sh
+++ b/src/vagrant/update.sh