Merge "Update dashboard"
[releng.git] / jjb / compass4nfv / compass-upload-artifact.sh
1 #!/bin/bash
2 set -o nounset
3 set -o pipefail
4
5 # log info to console
6 echo "Uploading the $INSTALLER_TYPE artifact. This could take some time..."
7 echo "--------------------------------------------------------"
8 echo
9
10 # source the opnfv.properties to get ARTIFACT_VERSION
11 source $BUILD_DIRECTORY/opnfv.properties
12
13 # upload artifact and additional files to google storage
14 gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
15 gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
16 gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
17
18 gsutil -m setmeta \
19     -h "Content-Type:text/html" \
20     -h "Cache-Control:private, max-age=0, no-transform" \
21     gs://$GS_URL/latest.properties \
22     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
23
24 gsutil -m setmeta \
25     -h "Cache-Control:private, max-age=0, no-transform" \
26     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
27
28 # disabled errexit due to gsutil setmeta complaints
29 #   BadRequestException: 400 Invalid argument
30 # check if we uploaded the file successfully to see if things are fine
31 gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
32 if [[ $? -ne 0 ]]; then
33     echo "Problem while uploading artifact!"
34     echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done."
35     exit 1
36 fi
37
38 echo
39 echo "--------------------------------------------------------"
40 echo "Done!"
41 echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"