summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2017-10-10 16:17:14 -0700
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2017-10-10 16:17:14 -0700
commitf6255c45367f39533b589a91ca351ad0bcfd0ac9 (patch)
treebc8a988232bad17d11fc4259c5ff4878b09c000e /jjb
parent4639c8a63b0f89e552dd574bc27973be8fb8b54d (diff)
Only Submit Security Scan Results that Exist
When anteater runs it generates a shortlog containing any errors that were encountered during it's run. If no errors exist it will still create an empty file 'shortlog'. A review containing no content will be attempt to be posted and fail with: fatal: Argument "{COMMIT | CHANGE,PATCHSET}" is required Instead of attempting to post nothing, the job should just skip submitting a review. Change-Id: I3feacb15e47dea204783053b3e67a9aa81ba164d Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/ci_gate_security/anteater-report-to-gerrit.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/jjb/ci_gate_security/anteater-report-to-gerrit.sh b/jjb/ci_gate_security/anteater-report-to-gerrit.sh
index de1fdd745..6710862a7 100644
--- a/jjb/ci_gate_security/anteater-report-to-gerrit.sh
+++ b/jjb/ci_gate_security/anteater-report-to-gerrit.sh
@@ -15,11 +15,14 @@ if [[ -e securityaudit.log ]] ; then
grep 'ERROR' securityaudit.log | awk -F"ERROR - " '{ print $2 }' | tr -d "\'\"" > shortlog
- ssh -p 29418 gerrit.opnfv.org \
- "gerrit review -p $GERRIT_PROJECT \
- -m \"$(cat shortlog)\" \
- $GERRIT_PATCHSET_REVISION \
- --notify NONE"
+ # Only report to Gerrit when there are errors to report.
+ if [[ -s shortlog ]]; then
+ ssh -p 29418 gerrit.opnfv.org \
+ "gerrit review -p $GERRIT_PROJECT \
+ -m \"$(cat shortlog)\" \
+ $GERRIT_PATCHSET_REVISION \
+ --notify NONE"
+ fi
exit $EXITSTATUS
fi