Merge "This patch includes scripts for implementing kvmfornfv daily jobs to trigger...
[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 if [[ "$JOB_NAME" =~ "merge" ]]; then
15     echo "Downloading http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties"
16     # get the properties file for the Daisy4nfv BIN built for a merged change
17     curl -s -o $WORKSPACE/latest.properties http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties
18 else
19     # get the latest.properties file in order to get info regarding latest artifact
20     echo "Downloading http://$GS_URL/latest.properties"
21     curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
22 fi
23
24 # check if we got the file
25 [[ -f latest.properties ]] || exit 1
26
27 # source the file so we get artifact metadata
28 source latest.properties
29
30 # echo the info about artifact that is used during the deployment
31 OPNFV_ARTIFACT=${OPNFV_ARTIFACT_URL/*\/}
32 echo "Using $OPNFV_ARTIFACT for deployment"
33
34 # log info to console
35 echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL"
36 echo "This could take some time..."
37 echo "--------------------------------------------------------"
38 echo
39
40 # download the file
41 curl -s -o $WORKSPACE/opnfv.bin http://$OPNFV_ARTIFACT_URL > gsutil.bin.log 2>&1
42
43 # list the file
44 ls -al $WORKSPACE/opnfv.bin
45
46 echo
47 echo "--------------------------------------------------------"
48 echo "Done!"