de560a645c762b320b381ee51181557215500322
[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 checkout_arm64(){
26   VERSION="dcc6d07"
27   git checkout ${VERSION}
28   sed -i 's:opnfv/:cyb70289/:' build/build-aarch64.yaml
29 }
30
31 check_env
32
33 echo "begin build compass"
34 git clone https://github.com/opnfv/compass4nfv.git
35
36 cd compass4nfv
37
38 if [ "$(uname -m)" = 'aarch64' ]; then
39   echo "Checkout compass4nfv to Arm64 version"
40   checkout_arm64
41 fi
42
43 COMPASS_WORK_DIR=$WORKSPACE/../compass-work
44
45 mkdir -p $COMPASS_WORK_DIR
46 ln -s $COMPASS_WORK_DIR work
47
48 sudo docker rm -f `sudo docker ps | grep compass | cut -f1 -d' '` || true
49
50 curl -sL http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true
51
52 ./build.sh
53
54 # Fix permissions so we can archive log files before pushing to Nexus
55 sudo chown $(id -u):$(id -g) -R "${WORKSPACE}"
56
57 exit 0