546f4e7e54d8166ca4e5f2c6f07f5290dc8c50e3
[releng.git] / jjb / securityscanning / opnfv-security-scan.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-scan-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-scan-verify-{stream}'
24
25     disabled: '{obj:disabled}'
26
27     parameters:
28         - project-parameter:
29             project: $GERRIT_PROJECT
30         - gerrit-parameter:
31             branch: '{branch}'
32
33     scm:
34         - gerrit-trigger-scm:
35             credentials-id: '{ssh-credentials}'
36             refspec: '$GERRIT_REFSPEC'
37             choosing-strategy: 'gerrit'
38
39     triggers:
40         - gerrit:
41             server-name: 'gerrit.opnfv.org'
42             trigger-on:
43                 - patchset-created-event:
44                     exclude-drafts: 'false'
45                     exclude-trivial-rebase: 'false'
46                     exclude-no-code-change: 'false'
47                 - draft-published-event
48                 - comment-added-contains-event:
49                     comment-contains-value: 'recheck'
50                 - comment-added-contains-event:
51                     comment-contains-value: 'reverify'
52             projects:
53               - project-compare-type: 'REG_EXP'
54                 project-pattern: 'sandbox'
55                 branches:
56                   - branch-compare-type: 'ANT'
57                     branch-pattern: '**/{branch}'
58                 file-paths:
59                   - compare-type: ANT
60                     pattern: '**/*.py'
61           skip-vote:
62             successful: true
63             failed: true
64             unstable: true
65             notbuilt: true
66
67     builders:
68         - security-scan-python-code
69         - report-security-scan-result-to-gerrit
70 ########################
71 # builder macros
72 ########################
73 - builder:
74     name: security-scan-python-code
75     builders:
76         - shell: |
77             #!/bin/bash
78             set -o errexit
79             set -o pipefail
80             set -o xtrace
81             export PATH=$PATH:/usr/local/bin/
82
83             # this is where the security/license scan script will be executed
84             echo "Hello World!"
85 - builder:
86     name: report-security-scan-result-to-gerrit
87     builders:
88         - shell: |
89             #!/bin/bash
90             set -o errexit
91             set -o pipefail
92             set -o xtrace
93             export PATH=$PATH:/usr/local/bin/
94
95             # If no violations were found, no lint log will exist.
96             if [[ -e securityscan.log ]] ; then
97                 echo -e "\nposting security scan report to gerrit...\n"
98
99                 cat securityscan.log
100                 echo
101
102                 ssh -p 29418 gerrit.opnfv.org \
103                     "gerrit review -p $GERRIT_PROJECT \
104                      -m \"$(cat securityscan.log)\" \
105                      $GERRIT_PATCHSET_REVISION \
106                      --notify NONE"
107
108                 exit 1
109             fi