Merge "joid: correct keystone ip fetch for noha mode - correct admin-password"
[releng.git] / jjb / fuel / fuel-upload-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 nounset
12 set -o pipefail
13
14 # check if we built something
15 if [ -f $WORKSPACE/.noupload ]; then
16     echo "Nothing new to upload. Exiting."
17     /bin/rm -f $WORKSPACE/.noupload
18     exit 0
19 fi
20
21 # log info to console
22 echo
23 echo "Uploading the $INSTALLER_TYPE artifact. This could take some time..."
24 echo
25
26 # source the opnfv.properties to get ARTIFACT_VERSION
27 source $WORKSPACE/opnfv.properties
28
29 # upload artifact and additional files to google storage
30 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
31     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
32 gsutil cp $WORKSPACE/opnfv.properties \
33     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
34 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
35     gsutil cp $WORKSPACE/opnfv.properties \
36     gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
37 elif [[ "$JOB_NAME" =~ "merge" ]]; then
38     echo "Uploaded Fuel ISO for a merged change"
39 fi
40
41 gsutil -m setmeta \
42     -h "Content-Type:text/html" \
43     -h "Cache-Control:private, max-age=0, no-transform" \
44     gs://$GS_URL/*.properties > /dev/null 2>&1
45
46 gsutil -m setmeta \
47     -h "Cache-Control:private, max-age=0, no-transform" \
48     gs://$GS_URL/*.iso > /dev/null 2>&1
49
50 echo "Done!"
51 echo
52 echo "--------------------------------------------------------"
53 echo
54 echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
55 echo
56 echo "--------------------------------------------------------"
57 echo