From 070e10f2ce201755dc244f42aa5272d6f918b633 Mon Sep 17 00:00:00 2001
From: Thanh Ha <thanh.ha@linuxfoundation.org>
Date: Tue, 1 May 2018 15:48:52 -0400
Subject: Update postbuildscript syntax for JJB 2.0.3

JJB 2.0.3 changed the postbuildscript syntax a bit and requires
changes so that they work properly with version 2.x of PostBuildScript
plugin.

This patch requires that Jenkins also be updated to install the 2.x
release of PostBuildScript.

Change-Id: I65e52c8d9b2efa38a3d16193c176c65e87e704c1
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
---
 jjb/global/releng-macros.yaml    | 40 +++++++++++++++++++++++++---------------
 jjb/xci/bifrost-verify-jobs.yaml | 14 ++++++++++----
 jjb/xci/xci-daily-jobs.yaml      | 14 ++++++++++----
 jjb/xci/xci-merge-jobs.yaml      | 14 ++++++++++----
 jjb/xci/xci-verify-jobs.yaml     | 14 ++++++++++----
 5 files changed, 65 insertions(+), 31 deletions(-)

(limited to 'jjb')

diff --git a/jjb/global/releng-macros.yaml b/jjb/global/releng-macros.yaml
index 1ff4799ab..b282cff4f 100644
--- a/jjb/global/releng-macros.yaml
+++ b/jjb/global/releng-macros.yaml
@@ -986,21 +986,31 @@
     name: 'report-provision-result'
     publishers:
       - postbuildscript:
-          script-only-if-succeeded: true
           builders:
-            - shell: |
-                echo "export PROVISION_RESULT=PASS" >> $WORKSPACE/installer_track.sh
-                echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
-                echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
-            - shell:
-                !include-raw: installer-report.sh
+            - role: BOTH
+              build-on:
+                - SUCCESS
+              build-steps:
+                - shell: |
+                    echo "export PROVISION_RESULT=PASS" >> $WORKSPACE/installer_track.sh
+                    echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
+                    echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
+                - shell:
+                    !include-raw: installer-report.sh
+          mark-unstable-if-failed: true
       - postbuildscript:
-          script-only-if-succeeded: false
-          script-only-if-failed: true
           builders:
-            - shell: |
-                echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
-                echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
-                echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
-            - shell:
-                !include-raw: installer-report.sh
+            - role: BOTH
+              build-on:
+                - ABORTED
+                - FAILURE
+                - NOT_BUILT
+                - UNSTABLE
+              build-steps:
+                - shell: |
+                    echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
+                    echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
+                    echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
+                - shell:
+                    !include-raw: installer-report.sh
+          mark-unstable-if-failed: true
diff --git a/jjb/xci/bifrost-verify-jobs.yaml b/jjb/xci/bifrost-verify-jobs.yaml
index 920ecdc7d..4ca783524 100644
--- a/jjb/xci/bifrost-verify-jobs.yaml
+++ b/jjb/xci/bifrost-verify-jobs.yaml
@@ -163,11 +163,17 @@
       # yamllint enable rule:line-length
       - email-jenkins-admins-on-failure
       - postbuildscript:
-          script-only-if-succeeded: false
-          script-only-if-failed: false
           builders:
-            - shell:
-                !include-raw: ./xci-cleanup.sh
+            - role: BOTH
+              build-on:
+                - ABORTED
+                - FAILURE
+                - NOT_BUILT
+                - SUCCESS
+                - UNSTABLE
+              build-steps:
+                - shell: !include-raw: ./xci-cleanup.sh
+          mark-unstable-if-failed: true
 
 # -------------------------------
 # trigger macros
diff --git a/jjb/xci/xci-daily-jobs.yaml b/jjb/xci/xci-daily-jobs.yaml
index 11db4e168..c1132ab85 100644
--- a/jjb/xci/xci-daily-jobs.yaml
+++ b/jjb/xci/xci-daily-jobs.yaml
@@ -155,11 +155,17 @@
       # yamllint enable rule:line-length
       - email-jenkins-admins-on-failure
       - postbuildscript:
-          script-only-if-succeeded: false
-          script-only-if-failed: false
           builders:
-            - shell:
-                !include-raw: ./xci-cleanup.sh
+            - role: BOTH
+              build-on:
+                - ABORTED
+                - FAILURE
+                - NOT_BUILT
+                - SUCCESS
+                - UNSTABLE
+              build-steps:
+                - shell: !include-raw: ./xci-cleanup.sh
+          mark-unstable-if-failed: true
 
 - job-template:
     name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
diff --git a/jjb/xci/xci-merge-jobs.yaml b/jjb/xci/xci-merge-jobs.yaml
index 2d112c7e5..cb438ad5d 100644
--- a/jjb/xci/xci-merge-jobs.yaml
+++ b/jjb/xci/xci-merge-jobs.yaml
@@ -316,11 +316,17 @@
 
     publishers:
       - postbuildscript:
-          script-only-if-succeeded: false
-          script-only-if-failed: false
           builders:
-            - shell:
-                !include-raw: ./xci-cleanup.sh
+            - role: BOTH
+              build-on:
+                - ABORTED
+                - FAILURE
+                - NOT_BUILT
+                - SUCCESS
+                - UNSTABLE
+              build-steps:
+                - shell: !include-raw: ./xci-cleanup.sh
+          mark-unstable-if-failed: true
 
 - job-template:
     name: 'xci-merge-{distro}-{phase}-virtual-{stream}'
diff --git a/jjb/xci/xci-verify-jobs.yaml b/jjb/xci/xci-verify-jobs.yaml
index 3b7df62f4..7dea53625 100644
--- a/jjb/xci/xci-verify-jobs.yaml
+++ b/jjb/xci/xci-verify-jobs.yaml
@@ -207,11 +207,17 @@
 
     publishers:
       - postbuildscript:
-          script-only-if-succeeded: false
-          script-only-if-failed: false
           builders:
-            - shell:
-                !include-raw: ./xci-cleanup.sh
+            - role: BOTH
+              build-on:
+                - ABORTED
+                - FAILURE
+                - NOT_BUILT
+                - SUCCESS
+                - UNSTABLE
+              build-steps:
+                - shell: !include-raw: ./xci-cleanup.sh
+          mark-unstable-if-failed: true
 
 
 - job-template:
-- 
cgit