kvmfornfv: Downloading sha512sum file of the guest image.
[releng.git] / jjb / kvmfornfv / kvmfornfv-download-artifact.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then
7     JOB_TYPE=${BASH_REMATCH[0]}
8 else
9     echo "Unable to determine job type!"
10     exit 1
11 fi
12
13 # do stuff differently based on the job type
14 case "$JOB_TYPE" in
15     verify)
16         echo "Downloading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..."
17         GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
18         ;;
19     daily)
20         gsutil cp gs://$GS_URL/latest.properties $WORKSPACE/latest.properties
21         source $WORKSPACE/latest.properties
22         GS_UPLOAD_LOCATION=$OPNFV_ARTIFACT_URL
23         echo "Downloading artifacts from $GS_UPLOAD_LOCATION for daily run. This could take some time..."
24         ;;
25     *)
26         echo "Artifact download is not enabled for $JOB_TYPE jobs"
27         exit 1
28 esac
29
30 GS_GUESTIMAGE_LOCATION="gs://artifacts.opnfv.org/$PROJECT/guest-image"
31 /bin/mkdir -p $WORKSPACE/build_output
32 gsutil cp -r $GS_UPLOAD_LOCATION/* $WORKSPACE/build_output > $WORKSPACE/gsutil.log 2>&1
33 gsutil cp $GS_GUESTIMAGE_LOCATION/guest1.sha512 $WORKSPACE/build_output > $WORKSPACE/gsutil.log 2>&1
34
35 echo "--------------------------------------------------------"
36 ls -al $WORKSPACE/build_output
37 echo "--------------------------------------------------------"
38 echo
39 echo "Downloaded artifacts!"