Fix the error when deploying VM by compass
[ci-management.git] / jjb / iec / iec-compass-build.sh
1 #!/bin/bash
2 set -ex
3
4 check_env(){
5   #Checking python-pip software status. If failed, reinstall it.
6   set +e
7   sudo pip --version
8   CHECK_PIP_SUDO=$?
9
10   pip --version
11   CHECK_PIP_USER=$?
12   set -e
13
14   #Check command result, if failed, reinstall the pip
15   if [ ${CHECK_PIP_SUDO} -ne 0 ] || [ ${CHECK_PIP_USER} -ne 0 ]; then
16     echo "Reinstall pip"
17     sudo python -m pip uninstall -y pip
18     curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
19     sudo python get-pip.py pip
20     rm get-pip.py
21     hash -r
22   fi
23 }
24
25 check_env
26
27 echo "begin build compass"
28 git clone https://github.com/opnfv/compass4nfv.git
29
30 cd compass4nfv
31
32 COMPASS_WORK_DIR=$WORKSPACE/../compass-work
33
34 mkdir -p $COMPASS_WORK_DIR
35 ln -s $COMPASS_WORK_DIR work
36
37 sudo docker rm -f `sudo docker ps | grep compass | cut -f1 -d' '` || true
38
39 curl -s http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true
40
41 ./build.sh
42
43 exit 0