From 48e9188db830c825c5212969e3cf85c055002f3c Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Thu, 28 Jul 2016 09:55:24 +0200 Subject: kvmfornfv: Create daily job and enable artifact upload Change-Id: I75b9bb58b3413514b1e3fea63185e210f56de95a Signed-off-by: Fatih Degirmenci --- jjb/kvmfornfv/kvmfornfv-download-artifact.sh | 20 +++++++++------ jjb/kvmfornfv/kvmfornfv-upload-artifact.sh | 27 ++++++++++++-------- jjb/kvmfornfv/kvmfornfv.yml | 37 +++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 19 deletions(-) (limited to 'jjb/kvmfornfv') diff --git a/jjb/kvmfornfv/kvmfornfv-download-artifact.sh b/jjb/kvmfornfv/kvmfornfv-download-artifact.sh index 875f42921..89b7e3164 100755 --- a/jjb/kvmfornfv/kvmfornfv-download-artifact.sh +++ b/jjb/kvmfornfv/kvmfornfv-download-artifact.sh @@ -7,16 +7,20 @@ else exit 1 fi -if [[ "$JOB_TYPE" == "verify" ]]; then - echo "Downloading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." - GS_URL="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" -else - echo "Artifact download is not enabled for $JOB_TYPE jobs" - exit 1 -fi +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Downloading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." + GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" + ;; + *) + echo "Artifact download is not enabled for $JOB_TYPE jobs" + exit 1 +esac /bin/mkdir -p $WORKSPACE/build_output -gsutil cp -r $GS_URL/* $WORKSPACE/build_output > $WORKSPACE/gsutil.log 2>&1 +gsutil cp -r $GS_UPLOAD_LOCATION/* $WORKSPACE/build_output > $WORKSPACE/gsutil.log 2>&1 + echo "--------------------------------------------------------" ls -al $WORKSPACE/build_output echo "--------------------------------------------------------" diff --git a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh index 339d260e3..190ab4b4d 100755 --- a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh +++ b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh @@ -7,20 +7,27 @@ else exit 1 fi -if [[ "$JOB_TYPE" == "verify" ]]; then - echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." - GS_URL="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" -else - echo "Artifact upload is not enabled for $JOB_TYPE jobs" - exit 1 -fi +case "$JOB_TYPE" in + verify) + echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." + GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" + ;; + daily) + echo "Uploding 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" + ;; + *) + echo "Artifact upload is not enabled for $JOB_TYPE jobs" + exit 1 +esac -gsutil cp -r $WORKSPACE/build_output $GS_URL > $WORKSPACE/gsutil.log 2>&1 +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_URL > /dev/null 2>&1 + $GS_UPLOAD_LOCATION > /dev/null 2>&1 -gsutil ls $GS_URL > /dev/null 2>&1 +gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1 if [[ $? -ne 0 ]]; then echo "Problem while uploading artifacts!" echo "Check log $WORKSPACE/gsutil.log on $NODE_NAME" diff --git a/jjb/kvmfornfv/kvmfornfv.yml b/jjb/kvmfornfv/kvmfornfv.yml index 77110bb74..5fcb27042 100644 --- a/jjb/kvmfornfv/kvmfornfv.yml +++ b/jjb/kvmfornfv/kvmfornfv.yml @@ -12,7 +12,6 @@ branch: 'stable/{stream}' gs-pathname: '/{stream}' disabled: true - ##################################### # patch verification phases ##################################### @@ -28,6 +27,7 @@ - 'kvmfornfv-verify-{stream}' - 'kvmfornfv-verify-{phase}-{stream}' - 'kvmfornfv-merge-{stream}' + - 'kvmfornfv-daily-{stream}' ##################################### # job templates ##################################### @@ -128,6 +128,8 @@ - gerrit-parameter: branch: '{branch}' - '{slave-label}-defaults' + - 'kvmfornfv-defaults': + gs-pathname: '{gs-pathname}' builders: - description-setter: @@ -168,6 +170,39 @@ builders: - shell: !include-raw: ./kvmfornfv-build.sh + +- job-template: + name: 'kvmfornfv-daily-{stream}' + + project-type: multijob + + disabled: '{obj:disabled}' + + concurrent: false + + parameters: + - project-parameter: + project: '{project}' + - gerrit-parameter: + branch: '{branch}' + - 'opnfv-build-ubuntu-defaults' + - 'kvmfornfv-defaults': + gs-pathname: '{gs-pathname}' + + scm: + - gerrit-trigger-scm: + credentials-id: '{ssh-credentials}' + refspec: '' + choosing-strategy: 'default' + + triggers: + - timed: '@midnight' + + builders: + - shell: + !include-raw-escape: ./kvmfornfv-build.sh + - shell: + !include-raw-escape: ./kvmfornfv-upload-artifact.sh ##################################### # builder macros ##################################### -- cgit 1.2.3-korg