Apex: fix deploy and test run job to pass empty refspec
[releng.git] / jjb / compass4nfv / compass-build.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5 set -x
6
7 # log info to console
8 echo "Starting the build of $INSTALLER_TYPE. This could take some time..."
9 echo "--------------------------------------------------------"
10 echo
11
12 # create the cache directory if it doesn't exist
13 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
14 [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
15
16 # set OPNFV_ARTIFACT_VERSION
17 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
18 export PACKAGE_URL=$PPA_REPO
19
20 # start the build
21 if [ -d $PPA_CACHE ]
22 then
23     cp $PPA_CACHE/*.tar.gz $PPA_CACHE/*.iso $PPA_CACHE/*.img $CACHE_DIRECTORY/ -f
24 fi
25
26 cd $WORKSPACE/
27 ./build.sh  --iso-dir $BUILD_DIRECTORY/ --iso-name compass.iso -c $CACHE_DIRECTORY
28
29 # list the build artifacts
30 ls -al $BUILD_DIRECTORY
31
32 # save information regarding artifact into file
33 (
34     echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
35     echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
36     echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
37     echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
38     echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)"
39     echo "OPNFV_BUILD_URL=$BUILD_URL"
40 ) > $BUILD_DIRECTORY/opnfv.properties
41 echo
42 echo "--------------------------------------------------------"
43 echo "Done!"