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 ##############################################################################
12 # check if we built something
13 if [ -f $WORKSPACE/.noupload ]; then
14 echo "Nothing new to upload. Exiting."
15 /bin/rm -f $WORKSPACE/.noupload
19 # source the opnfv.properties to get ARTIFACT_VERSION
20 source $WORKSPACE/opnfv.properties
22 # storing ISOs for verify & merge jobs will be done once we get the disk array
23 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
24 # store ISO locally on NFS first
25 ISOSTORE="/iso_mount/opnfv_ci/${GIT_BRANCH##*/}"
26 if [[ -d "$ISOSTORE" ]]; then
27 # remove all but most recent 5 ISOs first to keep iso_mount clean & tidy
29 ls -tp | grep -v '/' | tail -n +6 | xargs -d '\n' /bin/rm -f --
32 echo "Storing $INSTALLER_TYPE artifact on NFS..."
33 /bin/cp -f $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
34 $ISOSTORE/opnfv-$OPNFV_ARTIFACT_VERSION.iso
39 echo "Uploading $INSTALLER_TYPE artifact. This could take some time..."
43 # upload artifact and additional files to google storage
44 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
45 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
46 gsutil cp $WORKSPACE/opnfv.properties \
47 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
48 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
49 gsutil cp $WORKSPACE/opnfv.properties \
50 gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
51 elif [[ "$JOB_NAME" =~ "merge" ]]; then
52 echo "Uploaded Fuel ISO for a merged change"
56 -h "Content-Type:text/html" \
57 -h "Cache-Control:private, max-age=0, no-transform" \
58 gs://$GS_URL/latest.properties \
59 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
62 -h "Cache-Control:private, max-age=0, no-transform" \
63 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
65 # disabled errexit due to gsutil setmeta complaints
66 # BadRequestException: 400 Invalid argument
67 # check if we uploaded the file successfully to see if things are fine
68 gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
69 if [[ $? -ne 0 ]]; then
70 echo "Problem while uploading artifact!"
71 echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done."
77 echo "--------------------------------------------------------"
79 echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
81 echo "--------------------------------------------------------"