[docs] Limit git submodule recurse to depth 1
[releng.git] / jjb / fuel / fuel-download-artifact.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -o errexit
11 set -o pipefail
12
13 # disable Fuel ISO download for master branch
14 [[ ! "$BRANCH" =~ (danube) ]] && exit 0
15
16 # use proxy url to replace the normal URL, or googleusercontent.com will be blocked randomly
17 [[ "$NODE_NAME" =~ (zte) ]] && GS_URL=${GS_BASE_PROXY%%/*}/$GS_URL
18
19 # get the latest.properties file in order to get info regarding latest artifact
20 echo "Downloading http://$GS_URL/latest.properties"
21 curl -L -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
22
23 # check if we got the file
24 [[ -f $WORKSPACE/latest.properties ]] || exit 1
25
26 # source the file so we get artifact metadata
27 source $WORKSPACE/latest.properties
28
29 # echo the info about artifact that is used during the deployment
30 OPNFV_ARTIFACT=${OPNFV_ARTIFACT_URL/*\/}
31 echo "Using $OPNFV_ARTIFACT for deployment"
32
33 # check if we already have the ISO to avoid redownload
34 ISOSTORE="/iso_mount/opnfv_ci/${BRANCH##*/}"
35 if [[ -f "$ISOSTORE/$OPNFV_ARTIFACT" ]]; then
36     echo "ISO exists locally. Skipping the download and using the file from ISO store"
37     ln -s $ISOSTORE/$OPNFV_ARTIFACT $WORKSPACE/opnfv.iso
38     echo "--------------------------------------------------------"
39     echo
40     ls -al $WORKSPACE/opnfv.iso
41     echo
42     echo "--------------------------------------------------------"
43     echo "Done!"
44     exit 0
45 fi
46
47 [[ "$NODE_NAME" =~ (zte) ]] && OPNFV_ARTIFACT_URL=${GS_BASE_PROXY%%/*}/$OPNFV_ARTIFACT_URL
48
49 # log info to console
50 echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL"
51 echo "This could take some time..."
52 echo "--------------------------------------------------------"
53 echo
54
55 # download the file
56 curl -L -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
57
58 # list the file
59 ls -al $WORKSPACE/opnfv.iso
60
61 echo
62 echo "--------------------------------------------------------"
63 echo "Done!"