X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ci-management.git;a=blobdiff_plain;f=jjb%2Fiec%2Fiec-compass-build.sh;h=09dd66eed123d570051e9a2b9a32ac8d6a1cf105;hp=2014b802f6b6045c813255cdcacdee2c9d3957bc;hb=HEAD;hpb=67927999de6f8c75dc21059b3935279913855931 diff --git a/jjb/iec/iec-compass-build.sh b/jjb/iec/iec-compass-build.sh index 2014b80..09dd66e 100755 --- a/jjb/iec/iec-compass-build.sh +++ b/jjb/iec/iec-compass-build.sh @@ -1,22 +1,51 @@ #!/bin/bash -set -e +set -ex -echo "begin build compass" -git clone https://github.com/opnfv/compass4nfv.git +check_env(){ + #Checking python-pip software status. If failed, reinstall it. + set +e + sudo pip --version + CHECK_PIP_SUDO=$? -cd compass4nfv + pip --version + CHECK_PIP_USER=$? + set -e -COMPASS_WORK_DIR=$WORKSPACE/../compass-work + #Check command result, if failed, reinstall the pip + if [ ${CHECK_PIP_SUDO} -ne 0 ] || [ ${CHECK_PIP_USER} -ne 0 ]; then + echo "Reinstall pip" + sudo python -m pip uninstall -y pip + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + sudo python get-pip.py pip + rm get-pip.py + hash -r + fi -mkdir -p $COMPASS_WORK_DIR -ln -s $COMPASS_WORK_DIR work + # Clean environment + sudo docker rm -f `sudo docker ps | grep compass | cut -f1 -d' '` || true +} -sudo docker rm -f `docker ps | grep compass | cut -f1 -d' '` || true +build_compass(){ -curl -s http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true + echo "Clone compass4nfv" + git clone -b CompassinAkrainoIEC https://github.com/iecedge/compass4nfv.git -sed -i "s/sudo pip install pyyaml/python -m pip install pyyaml --user/g" build.sh + cd compass4nfv -./build.sh + COMPASS_WORK_DIR=$WORKSPACE/../compass-work + + mkdir -p $COMPASS_WORK_DIR + ln -snf $COMPASS_WORK_DIR work + + ./build.sh +} + +check_env + +# Build compass +build_compass + +# Fix permissions so we can archive log files before pushing to Nexus +sudo chown $(id -u):$(id -g) -R "${WORKSPACE}" exit 0