fc350235e5eacfb47b54adce5a193e07c8ead365
[releng.git] / jjb / fuel / fuel-upload-artifact.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 # check if we built something
7 if [ -f $WORKSPSACE/.noupload ]; then
8     echo "Nothing new to upload. Exiting."
9     /bin/rm -f $WORKSPSACE/.noupload
10     exit 0
11 fi
12
13 # log info to console
14 echo "Uploading the $INSTALLER_TYPE artifact. This could take some time..."
15 echo "--------------------------------------------------------"
16 echo
17
18 # source the opnfv.properties to get ARTIFACT_VERSION
19 source $WORKSPACE/opnfv.properties
20
21 # upload artifact and additional files to google storage
22 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
23     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
24 gsutil cp $WORKSPACE/opnfv.properties \
25     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
26 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
27     gsutil cp $WORKSPACE/opnfv.properties \
28     gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
29 elif [[ "$JOB_NAME" =~ "merge" ]]; then
30     echo "Uploaded Fuel ISO for a merged change"
31 fi
32
33 gsutil -m setmeta \
34     -h "Content-Type:text/html" \
35     -h "Cache-Control:private, max-age=0, no-transform" \
36     gs://$GS_URL/*.properties > /dev/null 2>&1
37
38 gsutil -m setmeta \
39     -h "Cache-Control:private, max-age=0, no-transform" \
40     gs://$GS_URL/*.iso > /dev/null 2>&1
41
42 echo
43 echo "--------------------------------------------------------"
44 echo "Done!"
45 echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"