use `bash` to parse shell
[releng.git] / jjb / compass4nfv / compass-download-artifact.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 # log info to console
7 echo "Downloading the $INSTALLER_TYPE artifact. This could take some time..."
8 echo "--------------------------------------------------------"
9 echo
10
11 # get the latest.properties file in order to get info regarding latest artifact
12 [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
13 curl -s -o $BUILD_DIRECTORY/latest.properties http://$GS_URL/latest.properties
14
15 # check if we got the file
16 [[ -f $BUILD_DIRECTORY/latest.properties ]] || exit 1
17
18 # source the file so we get OPNFV vars
19 source $BUILD_DIRECTORY/latest.properties
20
21 if [[ "$BRANCH" == 'stable/danube' ]]; then
22     # download the file
23     curl -s -o $BUILD_DIRECTORY/compass.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
24     # list the file
25     ls -al $BUILD_DIRECTORY/compass.iso
26 else
27     # download the file
28     curl -s -o $BUILD_DIRECTORY/compass.tar.gz http://$OPNFV_ARTIFACT_URL > gsutil.tar.gz.log 2>&1
29     # list the file
30     ls -al $BUILD_DIRECTORY/compass.tar.gz
31 fi
32
33 echo
34 echo "--------------------------------------------------------"
35 echo "Done!"