diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-10-16 00:00:29 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-10-15 22:03:04 +0000 |
commit | 888ff689d132d6dada6d3f36341ec7a95e88fbce (patch) | |
tree | d139b600ee0e2c49f5209cf4e936076eced4f81b | |
parent | c6729fc7c1f5e2c3c14c017d59a0fff641375206 (diff) |
Rework the messaging back to gerrit and improve escaping
This will allow to post more detailed messages back to gerrit.
Note the double quotes used and the eval before the ssh to enforce the expansion.
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Change-Id: I1c0d618796ef1cb697529575f7b9925ae4926a97
-rw-r--r-- | jjb/common/include-agl-lava-jobs-submit.sh | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/jjb/common/include-agl-lava-jobs-submit.sh b/jjb/common/include-agl-lava-jobs-submit.sh index 92a5ce80..9b876bf4 100644 --- a/jjb/common/include-agl-lava-jobs-submit.sh +++ b/jjb/common/include-agl-lava-jobs-submit.sh @@ -144,14 +144,36 @@ if [ -s job-result.fail ];then fi set -x -BUILD_LOG_MSG="LOGURL:\ ${BUILD_URL}consoleFull" +MSG_FAIL="CI-Image-Boot-Test fail on ${MACHINE}" +MSG_SUCCESS="CI-Image-Boot-Test success on ${MACHINE}" +MSG_BUILD_LOG="${BUILD_URL}consoleFull" +MSG_JOBFAIL="Failed jobs: +$(cat job-result.fail)" if [ $GOODJOB -eq 0 ];then + #construct message +cat << EOF > .msg +$MSG_FAIL + +Build log available at: $MSG_BUILD_LOG + +$MSG_JOBFAIL +EOF + # escape + sed -i -e "s/ /\\\ /g" .msg # send -1 - ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${GERRIT_CHANGE_NUMBER},${GERRIT_PATCHSET_NUMBER} --verified +1 --label ci-image-boot-test=-1 -n NONE --message="CI-Image-Boot-Test\ fail\ on\ ${MACHINE}\ ${BUILD_LOG_MSG}" || true + eval ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${GERRIT_CHANGE_NUMBER},${GERRIT_PATCHSET_NUMBER} --verified +1 --label ci-image-boot-test=-1 -n NONE --message='"$(cat .msg)"' || true else + #construct message +cat << EOF > .msg +$MSG_SUCCESS + +Build log available at: $MSG_BUILD_LOG +EOF + # escape + sed -i -e "s/ /\\\ /g" .msg # send +1 - ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${GERRIT_CHANGE_NUMBER},${GERRIT_PATCHSET_NUMBER} --verified +1 --label ci-image-boot-test=+1 -n NONE --message="CI-Image-Boot-Test\ success\ on\ ${MACHINE}\ ${BUILD_LOG_MSG}" || true + eval ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${GERRIT_CHANGE_NUMBER},${GERRIT_PATCHSET_NUMBER} --verified +1 --label ci-image-boot-test=+1 -n NONE --message='"$(cat .msg)"' || true fi set +x |