Add WhiteSource Scan jobs
[releng/global-jjb.git] / jjb / lf-whitesource-jobs.yaml
1 ---
2
3 ##########
4 # Macros #
5 ##########
6
7 - builder:
8     name: lf-infra-wss-unified-agent-scan
9     builders:
10       - shell: !include-raw:
11           - ../shell/whitesource-unified-agent-cli.sh
12
13 ####################
14 # COMMON FUNCTIONS #
15 ####################
16
17 - lf_whitesource_common: &lf_whitesource_common
18     name: lf-whitesource-common
19
20     ######################
21     # Default parameters #
22     ######################
23
24     archive-artifacts: >
25       **/*.log
26
27     #####################
28     # Job Configuration #
29     #####################
30
31     project-type: freestyle
32     node: '{build-node}'
33
34     properties:
35       - lf-infra-properties:
36           build-days-to-keep: '{build-days-to-keep}'
37
38     parameters:
39       - lf-infra-parameters:
40           project: '{project}'
41           branch: '{branch}'
42           stream: '{stream}'
43
44     wrappers:
45       - lf-infra-wrappers:
46           build-timeout: '{build-timeout}'
47           jenkins-ssh-credential: '{jenkins-ssh-credential}'
48       - credentials-binding:
49           - text:
50               credential-id: wss-apiKey
51               variable: wss-apiKey
52
53     publishers:
54       - lf-infra-publish
55
56 ##################################
57 # WHITESOURCE UNIFIED AGENT SCAN #
58 ##################################
59
60 - lf_wss_unified_agent_scan: &lf_wss_unified_agent_scan
61     name: lf-wss-unified-agent-scan
62
63     ######################
64     # Default parameters #
65     ######################
66
67     branch: master
68     build-days-to-keep: 30
69     build-timeout: 60
70     cron: '@daily'
71     disable-job: false
72     git-url: '$GIT_URL/$PROJECT'
73     github-url: 'https://github.com'
74     java-version: openjdk8
75     stream: master
76     submodule-recursive: true
77     submodule-timeout: 10
78     wss-unified-agent-opts: ''
79     wss-unified-agent-version: 19.2.2.2
80
81     gerrit_trigger_file_paths:
82       - compare-type: ANT
83         pattern: '.*'
84
85     # github_included_regions MUST match gerrit_trigger_file_paths
86     github_included_regions:
87       - '.*'
88
89     #####################
90     # Job Configuration #
91     #####################
92
93     disabled: '{disable-job}'
94
95     parameters:
96       - lf-infra-parameters:
97           project: '{project}'
98           branch: '{branch}'
99           stream: '{stream}'
100       - string:
101           name: WSS_PROJECT_NAME
102           default: '{project-name}'
103           description: Project to asociate the WhiteSource report in the dashboard.
104       - string:
105           name: WSS_PRODUCT_NAME
106           default: '{wss-product-name}'
107           description: Product to asociate the WhiteSource report in the dashboard.
108       - string:
109           name: WSS_UNIFIED_AGENT_CONFIG
110           default: '{wss-unified-agent-config}'
111           description: Path to wss-unifed-agent.config
112       - string:
113           name: WSS_UNIFIED_AGENT_OPTIONS
114           default: '{wss-unified-agent-opts}'
115           description: Options to pass to the WhiteSource Unified Agent CLI.
116       - string:
117           name: WSS_UNIFIED_AGENT_VERSION
118           default: '{wss-unified-agent-version}'
119           description: WhiteSource Unified Agent version package to download and use.
120
121     builders:
122       - lf-infra-pre-build
123       - lf-update-java-alternatives:
124           java-version: '{java-version}'
125       - lf-infra-wss-unified-agent-scan
126
127 - job-template:
128     name: '{project-name}-whitesource-scan-{stream}'
129     id: gerrit-whitesource-scan
130     <<: *lf_whitesource_common
131     # yamllint disable-line rule:key-duplicates
132     <<: *lf_wss_unified_agent_scan
133
134     ######################
135     # Default parameters #
136     ######################
137
138     gerrit_wss_triggers:
139       - comment-added-contains-event:
140           comment-contains-value: run-whitesource$
141
142     #####################
143     # Job Configuration #
144     #####################
145
146     scm:
147       - lf-infra-gerrit-scm:
148           jenkins-ssh-credential: '{jenkins-ssh-credential}'
149           git-url: '{git-url}'
150           refspec: '$GERRIT_REFSPEC'
151           branch: '$GERRIT_BRANCH'
152           submodule-recursive: '{submodule-recursive}'
153           submodule-timeout: '{submodule-timeout}'
154           choosing-strategy: default
155
156     triggers:
157       # Build weekly on Saturdays
158       - timed: '{obj:cron}'
159       - gerrit:
160           server-name: '{gerrit-server-name}'
161           trigger-on: '{obj:gerrit_wss_triggers}'
162           projects:
163             - project-compare-type: ANT
164               project-pattern: '{project}'
165               branches:
166                 - branch-compare-type: ANT
167                   branch-pattern: '**/{branch}'
168               file-paths: '{obj:gerrit_trigger_file_paths}'
169           skip-vote:
170             successful: true
171             failed: true
172             unstable: true
173             notbuilt: true
174
175 - job-template:
176     name: '{project-name}-whitesource-scan-{stream}'
177     id: github-whitesource-scan
178     <<: *lf_whitesource_common
179     # yamllint disable-line rule:key-duplicates
180     <<: *lf_wss_unified_agent_scan
181
182     properties:
183       - lf-infra-properties:
184           build-days-to-keep: '{build-days-to-keep}'
185       - github:
186           url: '{github-url}/{github-org}/{project}'
187
188     scm:
189       - lf-infra-github-scm:
190           url: '{git-clone-url}{github-org}/{project}'
191           refspec: ''
192           branch: 'refs/heads/{branch}'
193           submodule-recursive: '{submodule-recursive}'
194           submodule-timeout: '{submodule-timeout}'
195           choosing-strategy: default
196           jenkins-ssh-credential: '{jenkins-ssh-credential}'
197
198     triggers:
199       # Build weekly on Saturdays
200       - timed: '{obj:cron}'
201       - github-pull-request:
202           trigger-phrase: '^run-whitesource$'
203           only-trigger-phrase: false
204           status-context: 'WhiteSource'
205           permit-all: true
206           github-hooks: true
207           white-list-target-branches:
208             - '{branch}'
209           included-regions: '{obj:github_included_regions}'