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
23 # storing ISOs for verify & merge jobs will be done once we get the disk array
24 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
25 # store ISO locally on NFS first
26 ISOSTORE="/iso_mount/opnfv_ci/${GIT_BRANCH##*/}"
27 if [[ -d "$ISOSTORE" ]]; then
28 # remove all but most recent 5 ISOs first to keep iso_mount clean & tidy
30 ls -tp | grep -v '/' | tail -n +6 | xargs -d '\n' /bin/rm -f --
33 echo "Storing $INSTALLER_TYPE artifact on NFS..."
34 /bin/cp -f $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
35 $ISOSTORE/opnfv-$OPNFV_ARTIFACT_VERSION.iso
41 # clone releng repository
42 echo "Cloning releng repository..."
43 [ -d releng ] && rm -rf releng
44 git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
45 #this is where we import the siging key
46 if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
47 source $WORKSPACE/releng/utils/gpg_import_key.sh
52 gpg2 -vvv --batch --yes --no-tty \
53 --default-key opnfv-helpdesk@rt.linuxfoundation.org \
54 --passphrase besteffort \
55 --detach-sig $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso
57 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso.sig gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso.sig
58 echo "ISO signature Upload Complete!"
63 echo "Uploading $INSTALLER_TYPE artifact. This could take some time..."
67 # upload artifact and additional files to google storage
68 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
69 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
70 gsutil cp $WORKSPACE/opnfv.properties \
71 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
72 if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
73 gsutil cp $WORKSPACE/opnfv.properties \
74 gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
75 elif [[ "$JOB_NAME" =~ "merge" ]]; then
76 echo "Uploaded Fuel ISO for a merged change"
80 -h "Content-Type:text/html" \
81 -h "Cache-Control:private, max-age=0, no-transform" \
82 gs://$GS_URL/latest.properties \
83 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
86 -h "Cache-Control:private, max-age=0, no-transform" \
87 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
89 # disabled errexit due to gsutil setmeta complaints
90 # BadRequestException: 400 Invalid argument
91 # check if we uploaded the file successfully to see if things are fine
92 gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
93 if [[ $? -ne 0 ]]; then
94 echo "Problem while uploading artifact!"
95 echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done."
101 echo "--------------------------------------------------------"
103 echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
105 echo "--------------------------------------------------------"
111 if [[ "$JOB_NAME" =~ merge ]]; then
113 elif [[ "$JOB_NAME" =~ build ]]; then