Merge "support pagination in TestAPI"
[releng.git] / jjb / barometer / barometer-upload-artifact.sh
1 #!/bin/bash
2 set -o nounset
3 set -o pipefail
4
5 RPM_WORKDIR=$WORKSPACE/rpmbuild
6 RPM_DIR=$RPM_WORKDIR/RPMS/x86_64/
7 cd $WORKSPACE/
8
9 # source the opnfv.properties to get ARTIFACT_VERSION
10 source $WORKSPACE/opnfv.properties
11
12 # upload property files
13 gsutil cp $WORKSPACE/opnfv.properties gs://$OPNFV_ARTIFACT_URL/opnfv.properties > gsutil.properties.log 2>&1
14 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
15
16 echo "Uploading the barometer RPMs to artifacts.opnfv.org"
17 echo "---------------------------------------------------"
18 echo
19
20 gsutil -m cp -r $RPM_DIR/* $OPNFV_ARTIFACT_URL > $WORKSPACE/gsutil.log 2>&1
21
22 # Check if the RPMs were pushed
23 gsutil ls $OPNFV_ARTIFACT_URL > /dev/null 2>&1
24 if [[ $? -ne 0 ]]; then
25   echo "Problem while uploading barometer RPMs to $OPNFV_ARTIFACT_URL!"
26   echo "Check log $WORKSPACE/gsutil.log on the appropriate build server"
27   exit 1
28 fi
29
30 gsutil -m setmeta \
31     -h "Cache-Control:private, max-age=0, no-transform" \
32     gs://$OPNFV_ARTIFACT_URL/*.rpm > /dev/null 2>&1
33
34 echo
35 echo "--------------------------------------------------------"
36 echo "Done!"
37 echo "Artifact is available at $OPNFV_ARTIFACT_URL"
38
39 #cleanup the RPM repo from the build machine.
40 rm -rf $RPM_WORKDIR