diff options
-rwxr-xr-x | jjb/kvmfornfv/kvmfornfv-download-artifact.sh | 25 | ||||
-rwxr-xr-x | jjb/kvmfornfv/kvmfornfv-test.sh | 3 | ||||
-rwxr-xr-x | jjb/kvmfornfv/kvmfornfv-upload-artifact.sh | 29 | ||||
-rw-r--r-- | jjb/kvmfornfv/kvmfornfv.yml | 133 | ||||
-rw-r--r-- | jjb/opnfv/slave-params.yml | 14 |
5 files changed, 192 insertions, 12 deletions
diff --git a/jjb/kvmfornfv/kvmfornfv-download-artifact.sh b/jjb/kvmfornfv/kvmfornfv-download-artifact.sh new file mode 100755 index 000000000..24a5e45fe --- /dev/null +++ b/jjb/kvmfornfv/kvmfornfv-download-artifact.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + 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/review/$GERRIT_CHANGE_NUMBER" +else + echo "Artifact download is not enabled for $JOB_TYPE jobs" + exit 1 +fi + +/bin/mkdir -p $WORKSPACE/build_output +gsutil cp -r $GS_URL/* $WORKSPACE/build_output > $WORKSPACE/gsutil.log 2>&1 + +echo "--------------------------------------------------------" +ls -al $WORKSPACE/build_output +echo "--------------------------------------------------------" + +echo "Downloaded artifacts!" diff --git a/jjb/kvmfornfv/kvmfornfv-test.sh b/jjb/kvmfornfv/kvmfornfv-test.sh new file mode 100755 index 000000000..7a47f9a6e --- /dev/null +++ b/jjb/kvmfornfv/kvmfornfv-test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ls -al $WORKSPACE/build_output diff --git a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh new file mode 100755 index 000000000..81394561a --- /dev/null +++ b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +if [[ "$JOB_TYPE" == "verify" ]]; then + echo "Uploding artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." + GS_URL="gs://artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER" +else + echo "Artifact upload is not enabled for $JOB_TYPE jobs" + exit 1 +fi + +gsutil cp -r $WORKSPACE/build_output $GS_URL > $WORKSPACE/gsutil.log 2>&1 +gsutil -m setmeta -r \ + -h "Cache-Control:private, max-age=0, no-transform" \ + $GS_URL > /dev/null 2>&1 + +gsutil ls $GS_URL > /dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo "Problem while uploading artifacts!" + echo "Check log $WORKSPACE/gsutil.log on $NODE_NAME" + exit 1 +fi +echo "Uploaded artifacts!" diff --git a/jjb/kvmfornfv/kvmfornfv.yml b/jjb/kvmfornfv/kvmfornfv.yml index aa8b645f3..77110bb74 100644 --- a/jjb/kvmfornfv/kvmfornfv.yml +++ b/jjb/kvmfornfv/kvmfornfv.yml @@ -3,21 +3,49 @@ project: '{name}' - jobs: - - 'kvmfornfv-verify-{stream}' - - 'kvmfornfv-merge-{stream}' - stream: - master: branch: '{stream}' gs-pathname: '' + disabled: false - brahmaputra: branch: 'stable/{stream}' gs-pathname: '/{stream}' + disabled: true +##################################### +# patch verification phases +##################################### + phase: + - 'build': + slave-label: 'opnfv-build-ubuntu' + - 'test': + slave-label: 'intel-pod1' +##################################### +# patch verification phases +##################################### + jobs: + - 'kvmfornfv-verify-{stream}' + - 'kvmfornfv-verify-{phase}-{stream}' + - 'kvmfornfv-merge-{stream}' +##################################### +# job templates +##################################### - job-template: name: 'kvmfornfv-verify-{stream}' + project-type: multijob + + disabled: '{obj:disabled}' + + concurrent: true + + properties: + - throttle: + enabled: true + max-total: 3 + option: 'project' + parameters: - project-parameter: project: '{project}' @@ -25,12 +53,6 @@ branch: '{branch}' - 'opnfv-build-ubuntu-defaults' - scm: - - gerrit-trigger-scm: - credentials-id: '{ssh-credentials}' - refspec: '$GERRIT_REFSPEC' - choosing-strategy: 'gerrit' - triggers: - gerrit: trigger-on: @@ -51,8 +73,66 @@ branch-pattern: '**/{branch}' builders: - - shell: - !include-raw: ./kvmfornfv-build.sh + - description-setter: + description: "Built on $NODE_NAME" + - multijob: + name: build + condition: SUCCESSFUL + projects: + - name: 'kvmfornfv-verify-build-{stream}' + current-parameters: false + predefined-parameters: | + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER + node-parameters: false + kill-phase-on: FAILURE + abort-all-job: true + - multijob: + name: test + condition: SUCCESSFUL + projects: + - name: 'kvmfornfv-verify-test-{stream}' + current-parameters: false + predefined-parameters: | + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER + node-parameters: false + kill-phase-on: FAILURE + abort-all-job: true + +- job-template: + name: 'kvmfornfv-verify-{phase}-{stream}' + + disabled: '{obj:disabled}' + + concurrent: true + + scm: + - gerrit-trigger-scm: + credentials-id: '{ssh-credentials}' + refspec: '$GERRIT_REFSPEC' + choosing-strategy: 'gerrit' + + wrappers: + - ssh-agent-credentials: + users: + - '{ssh-credentials}' + - timeout: + timeout: 360 + fail: true + parameters: + - project-parameter: + project: '{project}' + - gerrit-parameter: + branch: '{branch}' + - '{slave-label}-defaults' + + builders: + - description-setter: + description: "Built on $NODE_NAME" + - '{project}-verify-{phase}-macro' - job-template: name: 'kvmfornfv-merge-{stream}' @@ -63,6 +143,8 @@ - gerrit-parameter: branch: '{branch}' - 'opnfv-build-ubuntu-defaults' + - 'kvmfornfv-defaults': + gs-pathname: '{gs-pathname}' scm: - gerrit-trigger-scm: @@ -86,3 +168,30 @@ builders: - shell: !include-raw: ./kvmfornfv-build.sh +##################################### +# builder macros +##################################### +- builder: + name: 'kvmfornfv-verify-build-macro' + builders: + - shell: + !include-raw: ./kvmfornfv-build.sh + - shell: + !include-raw: ./kvmfornfv-upload-artifact.sh +- builder: + name: 'kvmfornfv-verify-test-macro' + builders: + - shell: + !include-raw: ./kvmfornfv-download-artifact.sh + - shell: + !include-raw: ./kvmfornfv-test.sh +##################################### +# parameter macros +##################################### +- parameter: + name: 'kvmfornfv-defaults' + parameters: + - string: + name: GS_URL + default: artifacts.opnfv.org/$PROJECT{gs-pathname} + description: "URL to Google Storage." diff --git a/jjb/opnfv/slave-params.yml b/jjb/opnfv/slave-params.yml index 8b05bd7fa..b5cf4cd9d 100644 --- a/jjb/opnfv/slave-params.yml +++ b/jjb/opnfv/slave-params.yml @@ -229,6 +229,20 @@ default: https://gerrit.opnfv.org/gerrit/$PROJECT description: 'Git URL to use on this Jenkins Slave' - parameter: + name: 'intel-pod1-defaults' + parameters: + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - intel-pod1 + default-slaves: + - intel-pod1 + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' +- parameter: name: 'intel-pod2-defaults' parameters: - node: |