[Asterisk-code-review] CI: Fix bad reporting of status by the verification pub (asterisk[13])
George Joseph
asteriskteam at digium.com
Mon Jul 16 08:45:40 CDT 2018
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/9443
Change subject: CI: Fix bad reporting of status by the verification pub
......................................................................
CI: Fix bad reporting of status by the verification pub
Change-Id: I6f31a130b3ba0187149aaaa2ce94195a79e0f6a6
---
M tests/CI/ci.functions
M tests/CI/gates.jenkinsfile
M tests/CI/unittests.jenkinsfile
3 files changed, 46 insertions(+), 21 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/43/9443/1
diff --git a/tests/CI/ci.functions b/tests/CI/ci.functions
index 55c460e..67616c2 100644
--- a/tests/CI/ci.functions
+++ b/tests/CI/ci.functions
@@ -3,6 +3,7 @@
# and can be "source"d from the scripts.
#
+declare -a POSITIONAL_ARGS
for a in "$@" ; do
OPTION_COUNT+=1
case "$a" in
@@ -17,6 +18,9 @@
l=${BASH_REMATCH[1]//-/_}
eval ${l^^}=1
;;
+ *)
+ POSITIONAL_ARGS+=($a)
+ ;;
esac
done
diff --git a/tests/CI/gates.jenkinsfile b/tests/CI/gates.jenkinsfile
index 7df6a8e..6cbf104 100644
--- a/tests/CI/gates.jenkinsfile
+++ b/tests/CI/gates.jenkinsfile
@@ -195,25 +195,29 @@
script {
def cat
def comment
+ def rvalue
switch (currentBuild.currentResult) {
case ~/^SUCCESS$/:
cat = "Passed"
comment = ""
+ rvalue = 2
break
case ~/^FAILURE$/:
cat = "Failed"
comment = "Fatal Error"
+ rvalue = -1
break
case ~/^UNSTABLE$/:
cat = "Failed"
comment = "Tests Failed"
+ rvalue = -1
break
}
- gerritverificationpublisher verifyStatusCategory: cat,
- verifyStatusURL: '', verifyStatusComment: comment,
- verifyStatusName: '', verifyStatusReporter: 'Jenkins2',
- verifyStatusRerun: 'regate'
+ gerritverificationpublisher verifyStatusValue: rvalue,
+ verifyStatusCategory: cat, verifyStatusURL: '',
+ verifyStatusComment: comment, verifyStatusName: '',
+ verifyStatusReporter: 'Jenkins2', verifyStatusRerun: 'regate'
}
}
success {
diff --git a/tests/CI/unittests.jenkinsfile b/tests/CI/unittests.jenkinsfile
index d9f28e7..38e45fd 100644
--- a/tests/CI/unittests.jenkinsfile
+++ b/tests/CI/unittests.jenkinsfile
@@ -147,7 +147,7 @@
}
}
post {
- always {
+ cleanup {
sh "sudo make distclean 2&>/dev/null || : "
sh "sudo rm -rf tests/CI/output 2&>/dev/null || : "
}
@@ -155,27 +155,44 @@
* The Gerrit Trigger will automatically post the "Verified" results back
* to Gerrit but the verification publisher publishes extra stuff in the
* "Code Review" section of the review.
- */
+ */
+ always {
+ script {
+ def cat
+ def comment
+ def rvalue
+ switch (currentBuild.currentResult) {
+ case ~/^SUCCESS$/:
+ cat = "Passed"
+ comment = ""
+ rvalue = 1
+ break
+ case ~/^FAILURE$/:
+ cat = "Failed"
+ comment = "Fatal Error"
+ rvalue = -1
+ break
+ case ~/^UNSTABLE$/:
+ cat = "Failed"
+ comment = "Tests Failed"
+ rvalue = -1
+ break
+ }
+
+ gerritverificationpublisher verifyStatusValue: rvalue,
+ verifyStatusCategory: cat, verifyStatusURL: '',
+ verifyStatusComment: comment, verifyStatusName: '',
+ verifyStatusReporter: 'Jenkins2', verifyStatusRerun: 'regate'
+ }
+ }
success {
- echo "Reporting Passed"
- gerritverificationpublisher verifyStatusCategory: 'Passed',
- verifyStatusURL: '', verifyStatusComment: '',
- verifyStatusName: '', verifyStatusReporter: 'Jenkins2',
- verifyStatusRerun: 'recheck'
+ echo "Reporting ${currentBuild.currentResult} Passed"
}
failure {
- echo "Reporting Failed: Fatal Error"
- gerritverificationpublisher verifyStatusCategory: 'Failed',
- verifyStatusURL: '', verifyStatusComment: 'Fatal Error',
- verifyStatusName: '', verifyStatusReporter: 'Jenkins2',
- verifyStatusRerun: 'recheck'
+ echo "Reporting ${currentBuild.currentResult}: Failed: Fatal Error"
}
unstable {
- echo "Reporting Failed: Tests Failed"
- gerritverificationpublisher verifyStatusCategory: 'Failed',
- verifyStatusURL: '', verifyStatusComment: 'Tests Failed',
- verifyStatusName: '', verifyStatusReporter: 'Jenkins2',
- verifyStatusRerun: 'recheck'
+ echo "Reporting ${currentBuild.currentResult}: Failed: Tests Failed"
}
}
}
--
To view, visit https://gerrit.asterisk.org/9443
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f31a130b3ba0187149aaaa2ce94195a79e0f6a6
Gerrit-Change-Number: 9443
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180716/9a248c9d/attachment-0001.html>
More information about the asterisk-code-review
mailing list