summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rw-r--r--ci/Vagrantfile45
-rw-r--r--ci/bento.k8s.diff33
-rwxr-xr-xci/setup_vagrant.sh54
3 files changed, 68 insertions, 64 deletions
diff --git a/ci/Vagrantfile b/ci/Vagrantfile
deleted file mode 100644
index 7bee0ac..0000000
--- a/ci/Vagrantfile
+++ /dev/null
@@ -1,45 +0,0 @@
-Vagrant.require_version ">= 1.8.6"
-
-$script = <<SCRIPT
-#!/bin/bash
-wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys
-chmod 700 .ssh
-chmod 600 .ssh/authorized_keys
-chown -R vagrant:vagrant .ssh
-
-
-sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
-sudo apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D
-cat << EOF | sudo tee /etc/apt/sources.list.d/docker.list
-deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main
-EOF
-
-curl -s http://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
-cat <<EOF | tee /etc/apt/sources.list.d/kubernetes.list
-deb http://apt.kubernetes.io/ kubernetes-xenial main
-EOF
-apt-get update
-apt-get install -y --allow-downgrades docker-engine=1.12.6-0~ubuntu-xenial kubelet=1.7.0-00 kubeadm=1.7.0-00 kubectl=1.7.0-00 kubernetes-cni=0.5.1-00
-docker pull gcr.io/google_containers/kube-proxy-amd64:v1.7.10
-docker pull gcr.io/google_containers/kube-apiserver-amd64:v1.7.10
-docker pull gcr.io/google_containers/kube-controller-manager-amd64:v1.7.10
-docker pull gcr.io/google_containers/kube-scheduler-amd64:v1.7.10
-docker pull weaveworks/weave-npc:2.0.5
-docker pull weaveworks/weave-kube:2.0.5
-docker pull gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.4
-docker pull gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.4
-docker pull gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
-docker pull gcr.io/google_containers/etcd-amd64:3.0.17
-docker pull gcr.io/google_containers/pause-amd64:3.0
-SCRIPT
-
-Vagrant.configure("2") do |config|
-
- config.vm.box = "bento/ubuntu-16.04"
- config.ssh.insert_key = false
-
- config.vm.define "container4nfv" do |config|
- config.vm.hostname = "container4nfv"
- config.vm.provision "shell", inline: $script
- end
-end
diff --git a/ci/bento.k8s.diff b/ci/bento.k8s.diff
new file mode 100644
index 0000000..6fac10f
--- /dev/null
+++ b/ci/bento.k8s.diff
@@ -0,0 +1,33 @@
+diff --git a/ubuntu/scripts/update.sh b/ubuntu/scripts/update.sh
+index 9e872b6..02b9058 100644
+--- a/ubuntu/scripts/update.sh
++++ b/ubuntu/scripts/update.sh
+@@ -25,3 +25,28 @@ EOF
+
+ # Upgrade all installed packages incl. kernel and kernel headers
+ apt-get -y dist-upgrade -o Dpkg::Options::="--force-confnew";
++
++apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
++apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D
++cat << EOF | tee /etc/apt/sources.list.d/docker.list
++deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main
++EOF
++
++curl -s http://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
++cat <<EOF | tee /etc/apt/sources.list.d/kubernetes.list
++deb http://apt.kubernetes.io/ kubernetes-xenial main
++EOF
++apt-get update
++apt-get install -y --allow-downgrades docker-engine=1.12.6-0~ubuntu-xenial kubelet=1.7.0-00 kubeadm=1.7.0-00 kubectl=1.7.0-00 kubernetes-cni=0.5.1-00
++
++docker pull gcr.io/google_containers/kube-proxy-amd64:v1.7.10
++docker pull gcr.io/google_containers/kube-apiserver-amd64:v1.7.10
++docker pull gcr.io/google_containers/kube-controller-manager-amd64:v1.7.10
++docker pull gcr.io/google_containers/kube-scheduler-amd64:v1.7.10
++docker pull weaveworks/weave-npc:2.0.5
++docker pull weaveworks/weave-kube:2.0.5
++docker pull gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.4
++docker pull gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.4
++docker pull gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
++docker pull gcr.io/google_containers/etcd-amd64:3.0.17
++docker pull gcr.io/google_containers/pause-amd64:3.0
diff --git a/ci/setup_vagrant.sh b/ci/setup_vagrant.sh
index a7427be..3cc05de 100755
--- a/ci/setup_vagrant.sh
+++ b/ci/setup_vagrant.sh
@@ -2,27 +2,43 @@
set -ex
-cat << EOF | sudo tee /etc/sudoers.d/${USER}
+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
+ 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 update -y
-sudo apt-get install -y openssh-server git virtualbox
-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
+build_box() {
+ rm -rf ~/'VirtualBox VMs'/ubuntu-16.04-amd64
+ rm -rf bento
+ # Thanks Bento's great effort
+ # Bento project(https://github.com/chef/bento) is released by Apache 2.0 License
+ git clone https://github.com/chef/bento
+ cd bento; git checkout 05d98910d835b503e7be3d2e4071956f66fbbbc4
+ wget https://releases.hashicorp.com/packer/1.1.2/packer_1.1.2_linux_amd64.zip
+ unzip packer_1.1.2_linux_amd64.zip
+ patch -p1 < ../bento.k8s.diff
+ cd ubuntu
+ ../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
+}
-vagrant destroy -f; rm -rf package.box
-vagrant up
-VBoxManage list vms | grep container4nfv | cut -f2 -d'"' | xargs -I {} vagrant package --base {}
-vagrant box remove -f opnfv/container4nfv --all || true
-vagrant box add opnfv/container4nfv file:package.box
-vagrant destroy -f; rm -rf package.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
+}
-#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
+install_packages
+build_box