Merge branch 'docker-build' into osm/master
[osm/vim-emu.git] / utils / ci / jenkins_entrypoint.sh
1 #!/bin/bash
2 # Copyright (c) 2015 SONATA-NFV and Paderborn University
3 # ALL RIGHTS RESERVED.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # Neither the name of the SONATA-NFV, Paderborn University
18 # nor the names of its contributors may be used to endorse or promote
19 # products derived from this software without specific prior written
20 # permission.
21 #
22 # This work has been performed in the framework of the SONATA project,
23 # funded by the European Commission under Grant number 671517 through
24 # the Horizon 2020 and 5G-PPP programmes. The authors would like to
25 # acknowledge the contributions of their colleagues of the SONATA
26 # partner consortium (www.sonata-nfv.eu).
27 #
28 # This is the entry point for Jenkins.
29 # Script has to be called from "son-emu" root directory, like: sudo ./utils/ci/jenkins_entrypoint.sh
30 export DOCKER_HOST="unix:///var/run/docker.sock"
31
32 set -e
33 set -x
34
35 # install docker
36 #apt-get install curl apt-transport-https ca-certificates
37 #curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
38 #add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
39 #apt-get -qq update
40 #apt-get install docker-ce
41
42 # build the container
43 docker build -t test-son-emu-img .
44
45 # launch the container and trigger the unit tests
46 docker run --name son-emu --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock test-son-emu-img py.test -v src/emuvim/test/unittests
47
48 #
49 # old way to call the tests directly on the host machine
50 #
51 #SON_EMU_DIR=$(pwd)
52 #cd $SON_EMU_DIR/../
53
54 # prepare
55 #apt-get update
56 #DEBIAN_FRONTEND=noninteractive apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y git ansible aptitude
57 #echo "localhost ansible_connection=local" >> /etc/ansible/hosts
58
59 # install containernet
60 #git clone https://github.com/containernet/containernet.git
61 #CONTAINERNET_DIR=$(pwd)/containernet
62 #echo "Installing containernet (will take some time ~30 minutes) ..."
63 #cd $CONTAINERNET_DIR/ansible
64 #ansible-playbook install.yml
65
66 # install son-emu
67 #echo "Installing son-emu (will take some time) ..."
68 #cd $SON_EMU_DIR/ansible
69 #ansible-playbook install.yml
70
71 # execute son-emu tests at the end to validate installation
72 #echo "Running son-emu unit tests to validate installation"
73 #cd $SON_EMU_DIR
74 #python setup.py develop
75
76 # run the unit tests
77 #py.test -v src/emuvim/test/unittests
78
79