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
40 gsutil cp -r $WORKSPACE/build_output/* $GS_UPLOAD_LOCATION > $WORKSPACE/gsutil.log 2>&1
41 gsutil -m setmeta -r \
42 -h "Cache-Control:private, max-age=0, no-transform" \
43 $GS_UPLOAD_LOCATION > /dev/null 2>&1
45 # upload metadata file for the artifacts built by daily job
46 if [[ "$JOB_TYPE" == "daily" ]]; then
47 gsutil cp $WORKSPACE/opnfv.properties $GS_UPLOAD_LOCATION/opnfv.properties > $WORKSPACE/gsutil.log 2>&1
48 gsutil cp $WORKSPACE/opnfv.properties $GS_URL/latest.properties > $WORKSPACE/gsutil.log 2>&1
49 gsutil -m setmeta -r \
50 -h "Cache-Control:private, max-age=0, no-transform" \
51 $GS_UPLOAD_LOCATION/opnfv-${OPNFV_ARTIFACT_VERSION}.properties \
52 $GS_URL/latest.properties > /dev/null 2>&1
55 gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1
56 if [[ $? -ne 0 ]]; then
57 echo "Problem while uploading artifacts!"
58 echo "Check log $WORKSPACE/gsutil.log on $NODE_NAME"
61 echo "Uploaded artifacts!"