b9af2e8ad46f0bb5a09b919e801e23cffb3a4036
[releng.git] / jjb / daisy4nfv / daisy4nfv-download-artifact.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 ZTE Coreporation and others.
4 # hu.zhijiang@zte.com.cn
5 # sun.jing22@zte.com.cn
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11 set -o errexit
12 set -o pipefail
13
14 # use proxy url to replace the nomral URL, for googleusercontent.com will be blocked randomly
15 [[ "$NODE_NAME" =~ (zte) ]] && GS_URL=${GS_BASE_PROXY%%/*}/$GS_URL
16
17 if [[ "$JOB_NAME" =~ "merge" ]]; then
18     echo "Downloading http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties"
19     # get the properties file for the Daisy4nfv BIN built for a merged change
20     curl -L -s -o $WORKSPACE/latest.properties http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties
21 else
22     # get the latest.properties file in order to get info regarding latest artifact
23     echo "Downloading http://$GS_URL/latest.properties"
24     curl -L -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
25 fi
26
27 # check if we got the file
28 [[ -f $WORKSPACE/latest.properties ]] || exit 1
29
30 # source the file so we get artifact metadata
31 source $WORKSPACE/latest.properties
32
33 # echo the info about artifact that is used during the deployment
34 OPNFV_ARTIFACT=${OPNFV_ARTIFACT_URL/*\/}
35 echo "Using $OPNFV_ARTIFACT for deployment"
36
37 [[ "$NODE_NAME" =~ (zte) ]] && OPNFV_ARTIFACT_URL=${GS_BASE_PROXY%%/*}/$OPNFV_ARTIFACT_URL
38
39 # log info to console
40 echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL"
41 echo "This could take some time..."
42 echo "--------------------------------------------------------"
43 echo
44
45 # download the file
46 curl -L -s -o $WORKSPACE/opnfv.bin http://$OPNFV_ARTIFACT_URL > gsutil.bin.log 2>&1
47
48 # list the file
49 ls -al $WORKSPACE/opnfv.bin
50
51 echo
52 echo "--------------------------------------------------------"
53 echo "Done!"