summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-07-29 21:10:32 +0200
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-08-01 09:49:36 +0200
commitd75d9d1f69f1b0bdc378ed819335e2f3a2c5007c (patch)
tree5972a1ffa8e5e3d45c8a9050bdaaf0a5f2d1730f /jjb
parent421d147193e1ea8917968329ae8d6215975f1ce5 (diff)
kvmfornfv: Improve patch verification jobs
This change - changes the kvmfornfv-verify job to multijob so job abortion works when a new patch for the same change arrives - creates 2 phase jobs for patchset verification, build and test - enables artifact upload and download Change-Id: I9de85e2f223e83e2256aaba831b88b0a879962b5 Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Diffstat (limited to 'jjb')
-rwxr-xr-xjjb/kvmfornfv/kvmfornfv-download-artifact.sh25
-rwxr-xr-xjjb/kvmfornfv/kvmfornfv-test.sh3
-rwxr-xr-xjjb/kvmfornfv/kvmfornfv-upload-artifact.sh29
-rw-r--r--jjb/kvmfornfv/kvmfornfv.yml125
-rw-r--r--jjb/opnfv/slave-params.yml14
5 files changed, 190 insertions, 6 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..c5c122ea0 100644
--- a/jjb/kvmfornfv/kvmfornfv.yml
+++ b/jjb/kvmfornfv/kvmfornfv.yml
@@ -3,21 +3,47 @@
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}'
+ disabled: '{obj:disabled}'
+
+ concurrent: true
+
+ properties:
+ - throttle:
+ enabled: true
+ max-total: 3
+ option: 'project'
+
parameters:
- project-parameter:
project: '{project}'
@@ -51,8 +77,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 +147,8 @@
- gerrit-parameter:
branch: '{branch}'
- 'opnfv-build-ubuntu-defaults'
+ - 'kvmfornfv-defaults':
+ gs-pathname: '{gs-pathname}'
scm:
- gerrit-trigger-scm:
@@ -86,3 +172,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 7b9983060..a75fe11a5 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: