fc3018fb456a33b6679882439243642690f09c77
[releng.git] / jjb / ci_gate_security / anteater-report-to-gerrit.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 set -o pipefail
4 export PATH=$PATH:/usr/local/bin/
5 EXITSTATUS=0
6
7 # This Log should always exist
8 if [[ -e securityaudit.log ]] ; then
9     echo -e "\nposting security audit report to gerrit...\n"
10
11     #check if log has errors
12     if grep ERROR securityaudit.log; then
13         EXITSTATUS=1
14     fi
15     
16     cat securityaudit.log  | awk -F"ERROR - " '{print $2}' > shortlog
17     
18     ssh -p 29418 gerrit.opnfv.org \
19         "gerrit review -p $GERRIT_PROJECT \
20         -m \"$(cat shortlog)\" \
21         $GERRIT_PATCHSET_REVISION \
22         --notify NONE"
23     
24     exit $EXITSTATUS
25 fi