X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=jjb%2Fkvmfornfv%2Fkvmfornfv-upload-artifact.sh;h=56fb4f9c18a83c689a916dc6c85f9e3ddf2479b2;hb=79b920c07b40d64e70f93f28a0822ad1488f32ee;hp=422626ead660fe72b5faa13a7a443c3c3a1feeaa;hpb=2e261664b3b723061992be56eab7b506310f9ec5;p=releng.git diff --git a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh index 422626ead..56fb4f9c1 100755 --- a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh +++ b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh @@ -11,16 +11,17 @@ fi case "$JOB_TYPE" in verify) - OPNFV_ARTIFACT_VERSION="gerrit-$GERRIT_CHANGE_NUMBER" - GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" - echo "Removing outdated artifacts produced for the previous patch for the change $GERRIT_CHANGE_NUMBER" - gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1 && gsutil rm -r $GS_UPLOAD_LOCATION - echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." - ;; + OPNFV_ARTIFACT_VERSION="gerrit-$GERRIT_CHANGE_NUMBER" + GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" + echo "Removing outdated artifacts produced for the previous patch for the change $GERRIT_CHANGE_NUMBER" + gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1 && gsutil rm -r $GS_UPLOAD_LOCATION + echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." + ;; daily) echo "Uploading daily artifacts This could take some time..." OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S") GS_UPLOAD_LOCATION="gs://$GS_URL/$OPNFV_ARTIFACT_VERSION" + GS_LOG_LOCATION="gs://$GS_URL/logs-$(date -u +"%Y-%m-%d")"/ ;; *) echo "Artifact upload is not enabled for $JOB_TYPE jobs" @@ -35,21 +36,35 @@ esac echo "OPNFV_ARTIFACT_URL=$GS_UPLOAD_LOCATION" echo "OPNFV_BUILD_URL=$BUILD_URL" ) > $WORKSPACE/opnfv.properties +source $WORKSPACE/opnfv.properties # upload artifacts -gsutil cp -r $WORKSPACE/build_output/* $GS_UPLOAD_LOCATION > $WORKSPACE/gsutil.log 2>&1 -gsutil -m setmeta -r \ - -h "Cache-Control:private, max-age=0, no-transform" \ - $GS_UPLOAD_LOCATION > /dev/null 2>&1 +if [[ "$PHASE" == "build" ]]; then + gsutil cp -r $WORKSPACE/build_output/* $GS_UPLOAD_LOCATION > $WORKSPACE/gsutil.log 2>&1 + gsutil -m setmeta -r \ + -h "Cache-Control:private, max-age=0, no-transform" \ + $GS_UPLOAD_LOCATION > /dev/null 2>&1 +else + if [[ "$JOB_TYPE" == "daily" ]]; then + log_dir=$WORKSPACE/build_output/log + if [[ -d "$log_dir" ]]; then + #Uploading logs to artifacts + echo "Uploading artifacts for future debugging needs...." + gsutil cp -r $WORKSPACE/build_output/log-*.tar.gz $GS_LOG_LOCATION > $WORKSPACE/gsutil.log 2>&1 + else + echo "No test logs/artifacts available for uploading" + fi + fi +fi # upload metadata file for the artifacts built by daily job if [[ "$JOB_TYPE" == "daily" ]]; then gsutil cp $WORKSPACE/opnfv.properties $GS_UPLOAD_LOCATION/opnfv.properties > $WORKSPACE/gsutil.log 2>&1 - gsutil cp $WORKSPACE/opnfv.properties $GS_URL/latest.properties > $WORKSPACE/gsutil.log 2>&1 + gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > $WORKSPACE/gsutil.log 2>&1 gsutil -m setmeta -r \ -h "Cache-Control:private, max-age=0, no-transform" \ - $GS_UPLOAD_LOCATION/opnfv-${OPNFV_ARTIFACT_VERSION}.properties \ - $GS_URL/latest.properties > /dev/null 2>&1 + $GS_UPLOAD_LOCATION/opnfv.properties \ + gs://$GS_URL/latest.properties > /dev/null 2>&1 fi gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1