8ca0983c0e441d6771997d03103ee7c52c96bae0
[releng.git] / jjb / ci_gate_security / opnfv-ci-gate-security.yml
1 ########################
2 # Job configuration for opnfv-lint
3 ########################
4 - project:
5
6     name: anteaterfw
7
8     project: anteaterfw
9
10     jobs:
11         - 'opnfv-security-audit-verify-{stream}'
12
13     stream:
14         - master:
15             branch: '{stream}'
16             gs-pathname: ''
17             disabled: false
18
19 ########################
20 # job templates
21 ########################
22 - job-template:
23     name: 'opnfv-security-audit-verify-{stream}'
24
25     disabled: '{obj:disabled}'
26
27     parameters:
28         - project-parameter:
29             project: $GERRIT_PROJECT
30             branch: '{branch}'
31
32     scm:
33         - git-scm-gerrit
34
35     triggers:
36         - gerrit:
37             server-name: 'gerrit.opnfv.org'
38             trigger-on:
39                 - patchset-created-event:
40                     exclude-drafts: 'false'
41                     exclude-trivial-rebase: 'false'
42                     exclude-no-code-change: 'false'
43                 - draft-published-event
44                 - comment-added-contains-event:
45                     comment-contains-value: 'recheck'
46                 - comment-added-contains-event:
47                     comment-contains-value: 'reverify'
48             projects:
49               - project-compare-type: 'REG_EXP'
50                 project-pattern: 'sandbox'
51                 branches:
52                   - branch-compare-type: 'ANT'
53                     branch-pattern: '**/{branch}'
54                 file-paths:
55                   - compare-type: ANT
56                     pattern: '**'
57           skip-vote:
58             successful: true
59             failed: true
60             unstable: true
61             notbuilt: true
62
63     builders:
64         - anteater-security-audit
65 #        - report-security-audit-result-to-gerrit
66 ########################
67 # builder macros
68 ########################
69 - builder:
70     name: anteater-security-audit
71     builders:
72         - shell:
73             !include-raw: ./anteater-security-audit.sh
74
75 - builder:
76     name: report-security-audit-result-to-gerrit
77     builders:
78         - shell: |
79             #!/bin/bash
80             set -o errexit
81             set -o pipefail
82             set -o xtrace
83             export PATH=$PATH:/usr/local/bin/
84
85             # If no violations were found, no lint log will exist.
86             if [[ -e securityaudit.log ]] ; then
87                 echo -e "\nposting security audit report to gerrit...\n"
88
89                 cat securityaudit.log
90                 echo
91
92                 ssh -p 29418 gerrit.opnfv.org \
93                     "gerrit review -p $GERRIT_PROJECT \
94                      -m \"$(cat securityaudit.log)\" \
95                      $GERRIT_PATCHSET_REVISION \
96                      --notify NONE"
97
98                 exit 1
99             fi