Apex: fix deploy and test run job to pass empty refspec
[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 # clone releng repository
14 echo "Cloning releng repository..."
15 [ -d releng ] && rm -rf releng
16 git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
17 #this is where we import the siging key
18 if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
19   source $WORKSPACE/releng/utils/gpg_import_key.sh
20 fi
21
22 signiso () {
23 time gpg2 -vvv --batch --yes --no-tty \
24   --default-key opnfv-helpdesk@rt.linuxfoundation.org  \
25   --passphrase besteffort \
26   --detach-sig $BUILD_DIRECTORY/compass.iso
27
28 gsutil cp $BUILD_DIRECTORY/compass.iso.sig gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso.sig
29 echo "ISO signature Upload Complete!"
30 }
31
32 signiso
33
34 # upload artifact and additional files to google storage
35 gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
36 gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
37 gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
38
39 gsutil -m setmeta \
40     -h "Content-Type:text/html" \
41     -h "Cache-Control:private, max-age=0, no-transform" \
42     gs://$GS_URL/latest.properties \
43     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
44
45 gsutil -m setmeta \
46     -h "Cache-Control:private, max-age=0, no-transform" \
47     gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
48
49 # disabled errexit due to gsutil setmeta complaints
50 #   BadRequestException: 400 Invalid argument
51 # check if we uploaded the file successfully to see if things are fine
52 gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
53 if [[ $? -ne 0 ]]; then
54     echo "Problem while uploading artifact!"
55     echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done."
56     exit 1
57 fi
58
59 echo
60 echo "--------------------------------------------------------"
61 echo "Done!"
62 echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"