diff options
author | Julien <zhang.jun3g@zte.com.cn> | 2018-03-07 12:03:57 +0800 |
---|---|---|
committer | Julien <zhang.jun3g@zte.com.cn> | 2018-03-07 19:41:35 +0800 |
commit | 84e4b164e8a513f17f52e463120ae8a8d2ac2053 (patch) | |
tree | 887be85af1ee2ccdf248f08b3bfaa1fa593d12be /jjb | |
parent | 453b1f68cb2d6ebca8caf3aa62615659aefd1155 (diff) |
Update return value from postbuildscript
PostBuildScript plugin's result affects Jenkins pipeline, so we should
return the original job running status in the postbuildscript in the end
Update macros:
1. from $POD_NAME to $NODE_NAME
2. from $SCENARIO to $DEPLOY_SCENARIO
2. {installer} to $INSTALLER_TYPE for {installer} is not existed in
trigger job
3. add parameters definition for they can not be used in trigger jobs by
predefined-parameters
4. missing TIMESTAMP_END
Change-Id: I354be3d5ad02e53bb988995adc09b59e92a1640a
Signed-off-by: Julien <zhang.jun3g@zte.com.cn>
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/daisy4nfv/daisy-daily-jobs.yml | 9 | ||||
-rwxr-xr-x | jjb/global/installer-report.sh | 16 | ||||
-rw-r--r-- | jjb/global/releng-macros.yml | 6 |
3 files changed, 26 insertions, 5 deletions
diff --git a/jjb/daisy4nfv/daisy-daily-jobs.yml b/jjb/daisy4nfv/daisy-daily-jobs.yml index fbbb086d7..c354ca655 100644 --- a/jjb/daisy4nfv/daisy-daily-jobs.yml +++ b/jjb/daisy4nfv/daisy-daily-jobs.yml @@ -120,6 +120,15 @@ - string: name: DEPLOY_SCENARIO default: '{scenario}' + - string: + name: INSTALLER_VERSION + default: '' + - string: + name: UPSTREAM_JOB_NAME + default: '' + - string: + name: UPSTREAM_BUILD_ID + default: '' - 'daisy-project-parameter': gs-pathname: '{gs-pathname}' diff --git a/jjb/global/installer-report.sh b/jjb/global/installer-report.sh index c9c730594..6cd83f1f1 100755 --- a/jjb/global/installer-report.sh +++ b/jjb/global/installer-report.sh @@ -15,10 +15,10 @@ gen_content() { "installer": "$INSTALLER", "version": "$INSTALLER_VERSION", - "pod_name": "$POD_NAME", + "pod_name": "$NODE_NAME", "job_name": "$JOB_NAME", "build_id": "$BUILD_ID", - "scenario": "$SCENARIO", + "scenario": "$DEPLOY_SCENARIO", "upstream_job_name": "$UPSTREAM_JOB_NAME", "upstream_build_id":"$UPSTREAM_BUILD_ID", "criteria": "$PROVISION_RESULT", @@ -33,4 +33,14 @@ echo "Installer: $INSTALLER provision result: $PROVISION_RESULT" echo $(gen_content) set -o xtrace -curl -H "Content-Type: application/json" -X POST -v -d "$(gen_content)" $TESTAPI_URL/deployresults +curl -H "Content-Type: application/json" -X POST -v -d "$(gen_content)" \ + $TESTAPI_URL/deployresults || true + +# INFO +# postbuildscript plugin shall always return the original job running status, +# for the result returned from postbuildscript affects the CI pipeline. +if [ "$PROVISION_RESULT" == "PASS" ]; then + exit 0 +else + exit 1 +fi diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index e172d856b..8f032345e 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -965,7 +965,8 @@ builders: - shell: | echo "export PROVISION_RESULT=PASS" >> $WORKSPACE/installer_track.sh - echo "export INSTALLER={installer}" >> $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 - postbuildscript: @@ -974,6 +975,7 @@ builders: - shell: | echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh - echo "export INSTALLER={installer}" >> $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 |