Add macro for reporting the provision result 15/48515/8
authorJulien <zhang.jun3g@zte.com.cn>
Thu, 7 Dec 2017 09:52:04 +0000 (01:52 -0800)
committerJulien <zhang.jun3g@zte.com.cn>
Mon, 15 Jan 2018 14:13:44 +0000 (22:13 +0800)
1. add macro for report the provision result of installers
and try it in daisy
2. update according to TestAPI interface

Change-Id: Ic041744c917c37fcd84a12a92e927e39106cf18f
Signed-off-by: Julien <zhang.jun3g@zte.com.cn>
jjb/daisy4nfv/daisy-daily-jobs.yml
jjb/global/installer-report.sh [new file with mode: 0755]
jjb/global/releng-macros.yml

index 3aa9505..5a0e321 100644 (file)
             current-parameters: false
             predefined-parameters:
               DEPLOY_SCENARIO={scenario}
+              INSTALLER_VERSION={stream}
+              UPSTREAM_JOB_NAME=$JOB_NAME
+              UPSTREAM_BUILD_ID=$BUILD_ID
             same-node: true
             block: true
       - trigger-builds:
             current-parameters: false
             predefined-parameters:
               DEPLOY_SCENARIO={scenario}
+              INSTALLER_VERSION={stream}
+              UPSTREAM_JOB_NAME=$JOB_NAME
+              UPSTREAM_BUILD_ID=$BUILD_ID
             same-node: true
             block: true
             block-thresholds:
                   current-parameters: false
                   predefined-parameters:
                     DEPLOY_SCENARIO={scenario}
+                    INSTALLER_VERSION={stream}
+                    UPSTREAM_JOB_NAME=$JOB_NAME
+                    UPSTREAM_BUILD_ID=$BUILD_ID
                   block: true
                   same-node: true
                   block-thresholds:
     builders:
       - description-setter:
           description: "POD: $NODE_NAME"
+      - 'track-begin-timestamp'
       - shell:
           !include-raw-escape: ./daisy4nfv-download-artifact.sh
       - shell:
           !include-raw-escape: ./daisy-deploy.sh
+    publishers:
+      - 'report-provision-result'
 
 ########################
 # trigger macros
diff --git a/jjb/global/installer-report.sh b/jjb/global/installer-report.sh
new file mode 100755 (executable)
index 0000000..e2fcfd6
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+source $WORKSPACE/installer_track.sh
+echo """
+    INSTALLER: $INSTALLER
+    INSTALLER_VERSION: $INSTALLER_VERSION
+    JOB_NAME: $JOB_NAME
+    BUILD_ID: $BUILD_ID
+    SENARIO: $DEPLOY_SCENARIO
+    UPSTREAM_JOB_NAME: $UPSTREAM_JOB_NAME:
+    UPSTREAM_BUILD_ID: $UPSTREAM_BUILD_ID
+    PROVISION_RESULT: $PROVISION_RESULT
+    TIMESTAMP_START: $TIMESTAMP_START
+    TIMESTAMP_END: `date '+%Y-%m-%d %H:%M:%S.%3N'`
+    POD_NAME: $NODE_NAME
+"""
+
+# TODO call TestAPI to report installer provisoin result when API is ready
index aeeb246..c2cff32 100644 (file)
       - shell: |
           find $WORKSPACE -type f -name '*.log' | xargs rm -f
 
+- builder:
+    name: track-begin-timestamp
+    builders:
+      - shell: |
+          echo "export TIMESTAMP_START="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' > $WORKSPACE/installer_track.sh
+
 - publisher:
     name: archive-artifacts
     publishers:
           <<: *email_ptl_defaults
           recipients: >
             ross.b.brattain@intel.com
+
+- publisher:
+    name: 'report-provision-result'
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: true
+          builders:
+            - shell: |
+                echo "export PROVISION_RESULT=SUCCEED" >> $WORKSPACE/installer_track.sh
+                echo "export INSTALLER={installer}" >> $WORKSPACE/installer_track.sh
+            - shell:
+                !include-raw-escape: installer-report.sh
+      - postbuildscript:
+          script-only-if-failed: true
+          builders:
+            - shell: |
+                echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
+                echo "export INSTALLER={installer}" >> $WORKSPACE/installer_track.sh
+            - shell:
+                !include-raw-escape: installer-report.sh