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