5 if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then
6 JOB_TYPE=${BASH_REMATCH[0]}
8 echo "Unable to determine job type!"
14 OPNFV_ARTIFACT_VERSION="gerrit-$GERRIT_CHANGE_NUMBER"
15 GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
16 echo "Removing outdated artifacts produced for the previous patch for the change $GERRIT_CHANGE_NUMBER"
17 gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1 && gsutil rm -r $GS_UPLOAD_LOCATION
18 echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..."
21 echo "Uploading daily artifacts This could take some time..."
22 OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
23 GS_UPLOAD_LOCATION="gs://$GS_URL/$OPNFV_ARTIFACT_VERSION"
26 echo "Artifact upload is not enabled for $JOB_TYPE jobs"
30 # save information regarding artifacts into file
32 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
33 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
34 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
35 echo "OPNFV_ARTIFACT_URL=$GS_UPLOAD_LOCATION"
36 echo "OPNFV_BUILD_URL=$BUILD_URL"
37 ) > $WORKSPACE/opnfv.properties
38 source $WORKSPACE/opnfv.properties
41 gsutil cp -r $WORKSPACE/build_output/* $GS_UPLOAD_LOCATION > $WORKSPACE/gsutil.log 2>&1
42 gsutil -m setmeta -r \
43 -h "Cache-Control:private, max-age=0, no-transform" \
44 $GS_UPLOAD_LOCATION > /dev/null 2>&1
46 # upload metadata file for the artifacts built by daily job
47 if [[ "$JOB_TYPE" == "daily" ]]; then
48 gsutil cp $WORKSPACE/opnfv.properties $GS_UPLOAD_LOCATION/opnfv.properties > $WORKSPACE/gsutil.log 2>&1
49 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > $WORKSPACE/gsutil.log 2>&1
50 gsutil -m setmeta -r \
51 -h "Cache-Control:private, max-age=0, no-transform" \
52 $GS_UPLOAD_LOCATION/opnfv.properties \
53 gs://$GS_URL/latest.properties > /dev/null 2>&1
56 gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1
57 if [[ $? -ne 0 ]]; then
58 echo "Problem while uploading artifacts!"
59 echo "Check log $WORKSPACE/gsutil.log on $NODE_NAME"
62 echo "Uploaded artifacts!"