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 ##############################################################################
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
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
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
27 # check if we got the file
28 [[ -f $WORKSPACE/latest.properties ]] || exit 1
30 # source the file so we get artifact metadata
31 source $WORKSPACE/latest.properties
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"
37 [[ "$NODE_NAME" =~ (zte) ]] && OPNFV_ARTIFACT_URL=${GS_BASE_PROXY%%/*}/$OPNFV_ARTIFACT_URL
39 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
40 # check if we already have the image to avoid redownload
41 BINSTORE="/bin_mount/opnfv_ci/${BRANCH##*/}"
42 if [[ -f "$BINSTORE/$OPNFV_ARTIFACT" && ! -z $OPNFV_ARTIFACT_SHA512SUM ]]; then
43 echo "BIN exists locally. Starting to check the sha512sum."
44 if [[ $OPNFV_ARTIFACT_SHA512SUM = $(sha512sum -b $BINSTORE/$OPNFV_ARTIFACT | cut -d' ' -f1) ]]; then
45 echo "Sha512sum is verified. Skipping the download and using the file from BIN store."
46 ln -s $BINSTORE/$OPNFV_ARTIFACT $WORKSPACE/opnfv.bin
47 echo "--------------------------------------------------------"
49 ls -al $WORKSPACE/opnfv.bin
51 echo "--------------------------------------------------------"
59 echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL"
60 echo "This could take some time... Now the time is $(date -u)"
61 echo "--------------------------------------------------------"
65 if [[ "$NODE_NAME" =~ (zte) ]] && [ -x "$(command -v aria2c)" ]; then
66 DOWNLOAD_CMD="aria2c -x 3 --allow-overwrite=true -d $WORKSPACE -o opnfv.bin"
68 DOWNLOAD_CMD="curl -L -s -o $WORKSPACE/opnfv.bin"
74 while [ $cnt -lt $maxretries ] && [ $rc -ne 0 ]
77 $DOWNLOAD_CMD http://$OPNFV_ARTIFACT_URL > gsutil.bin.log 2>&1
82 ls -al $WORKSPACE/opnfv.bin
85 echo "--------------------------------------------------------"