Move required params to defaults section in views
[releng/global-jjb.git] / jjb / lf-python-jobs.yaml
1 ---
2
3 ##########
4 # Macros #
5 ##########
6
7 - builder:
8     name: lf-infra-tox-install
9     builders:
10       - inject:
11           properties-content: 'PYTHON_VERSION={python-version}'
12       - shell: !include-raw-escape: ../shell/tox-install.sh
13
14 - builder:
15     name: lf-infra-clm-python
16     builders:
17       - inject:
18           properties-content: 'CLM_PROJECT_NAME={clm-project-name}'
19       - shell: !include-raw-escape:
20           - ../shell/nexus-iq-cli.sh
21
22 ####################
23 # COMMON FUNCTIONS #
24 ####################
25
26 - lf_python_common: &lf_python_common
27     name: lf-python-common
28
29     ######################
30     # Default parameters #
31     ######################
32
33     archive-artifacts: >
34       **/*.log
35
36     #####################
37     # Job Configuration #
38     #####################
39
40     project-type: freestyle
41     node: '{build-node}'
42
43     properties:
44       - lf-infra-properties:
45           build-days-to-keep: '{build-days-to-keep}'
46
47     parameters:
48       - lf-infra-parameters:
49           project: '{project}'
50           branch: '{branch}'
51           stream: '{stream}'
52           lftools-version: '{lftools-version}'
53
54     wrappers:
55       - lf-infra-wrappers:
56           build-timeout: '{build-timeout}'
57           jenkins-ssh-credential: '{jenkins-ssh-credential}'
58
59     publishers:
60       - lf-infra-publish
61
62 #################
63 # Python XC CLM #
64 #################
65
66 - lf_python_clm_xc: &lf_python_xc_clm
67     name: lf-python-xc-clm
68
69     ######################
70     # Default parameters #
71     ######################
72
73     branch: master
74     build-days-to-keep: 30  # 30 days for troubleshooting purposes
75     build-timeout: 60
76     disable-job: false
77     git-url: '$GIT_URL/$PROJECT'
78     github-url: 'https://github.com'
79     java-version: openjdk8
80     nexus-iq-cli-version: 1.44.0-01
81     nexus-iq-namespace: ''  # Recommend a trailing dash when set. Example: odl-
82     stream: master
83     submodule-recursive: true
84     submodule-timeout: 10
85
86     gerrit_trigger_file_paths:
87       - compare-type: ANT
88         pattern: '.*'
89
90     # github_included_regions MUST match gerrit_trigger_file_paths
91     github_included_regions:
92       - '.*'
93
94     #####################
95     # Job Configuration #
96     #####################
97
98     disabled: '{disable-job}'
99
100     parameters:
101       - lf-infra-parameters:
102           project: '{project}'
103           branch: '{branch}'
104           stream: '{stream}'
105           lftools-version: '{lftools-version}'
106       - string:
107           name: NEXUS_IQ_CLI_VERSION
108           default: '{nexus-iq-cli-version}'
109           description: Nexus IQ CLI package to download and use.
110
111     wrappers:
112       - credentials-binding:
113           - username-password-separated:
114               credential-id: nexus-iq-xc-clm
115               username: CLM_USER
116               password: CLM_PASSWORD
117     builders:
118       - lf-update-java-alternatives:
119           java-version: '{java-version}'
120       - lf-infra-clm-python:
121           clm-project-name: '{nexus-iq-namespace}{project-name}'
122
123 - job-template:
124     name: '{project-name}-python-clm-{stream}'
125     id: gerrit-python-xc-clm
126     <<: *lf_python_common
127     # yamllint disable-line rule:key-duplicates
128     <<: *lf_python_xc_clm
129
130     ######################
131     # Default parameters #
132     ######################
133
134     gerrit_clm_triggers:
135       - comment-added-contains-event:
136           comment-contains-value: run-clm$
137
138     #####################
139     # Job Configuration #
140     #####################
141
142     scm:
143       - lf-infra-gerrit-scm:
144           jenkins-ssh-credential: '{jenkins-ssh-credential}'
145           git-url: '{git-url}'
146           refspec: '$GERRIT_REFSPEC'
147           branch: '$GERRIT_BRANCH'
148           submodule-recursive: '{submodule-recursive}'
149           submodule-timeout: '{submodule-timeout}'
150           choosing-strategy: default
151
152     triggers:
153       # Build weekly on Saturdays
154       - timed: 'H H * * 6'
155       - gerrit:
156           server-name: '{gerrit-server-name}'
157           trigger-on: '{obj:gerrit_clm_triggers}'
158           projects:
159             - project-compare-type: ANT
160               project-pattern: '{project}'
161               branches:
162                 - branch-compare-type: ANT
163                   branch-pattern: '**/{branch}'
164               file-paths: '{obj:gerrit_trigger_file_paths}'
165           skip-vote:
166             successful: true
167             failed: true
168             unstable: true
169             notbuilt: true
170
171 - job-template:
172     name: '{project-name}-python-clm-{stream}'
173     id: github-python-xc-clm
174     <<: *lf_python_common
175     # yamllint disable-line rule:key-duplicates
176     <<: *lf_python_xc_clm
177
178     properties:
179       - lf-infra-properties:
180           build-days-to-keep: '{build-days-to-keep}'
181       - github:
182           url: '{github-url}/{github-org}/{project}'
183
184     scm:
185       - lf-infra-github-scm:
186           url: '{git-clone-url}{github-org}/{project}'
187           refspec: ''
188           branch: 'refs/heads/{branch}'
189           submodule-recursive: '{submodule-recursive}'
190           submodule-timeout: '{submodule-timeout}'
191           choosing-strategy: default
192           jenkins-ssh-credential: '{jenkins-ssh-credential}'
193
194     triggers:
195       # Build weekly on Saturdays
196       - timed: 'H H * * 6'
197       - github-pull-request:
198           trigger-phrase: '^run-clm$'
199           only-trigger-phrase: false
200           status-context: 'CLM'
201           permit-all: true
202           github-hooks: true
203           white-list-target-branches:
204             - '{branch}'
205           included-regions: '{obj:github_included_regions}'
206
207 ########################
208 # Python Sonar with Tox #
209 ########################
210
211 - lf_tox_sonar: &lf_tox_sonar
212     name: lf-tox_sonar
213
214     ######################
215     # Default parameters #
216     ######################
217
218     branch: master  # Sonar should always be run on master branch
219     build-days-to-keep: 7
220     build-timeout: 60
221     cron: 'H H * * *'  # run daily
222     disable-job: false
223     git-url: '$GIT_URL/$PROJECT'
224     github-url: 'https://github.com'
225     java-version: openjdk8
226     python-version: python2
227     mvn-global-settings: global-settings
228     mvn-settings: '{mvn-settings}'
229     mvn-version: mvn35
230     sonar-mvn-goal: 'sonar:sonar'
231     stream: master
232     submodule-recursive: true
233     submodule-timeout: 10
234
235     gerrit_trigger_file_paths:
236       - compare-type: REG_EXP
237         pattern: '.*'
238
239     # github_included_regions MUST match gerrit_trigger_file_paths
240     github_included_regions:
241       - '.*'
242
243     #####################
244     # Job Configuration #
245     #####################
246
247     disabled: '{disable-job}'
248
249     parameters:
250       - lf-infra-parameters:
251           project: '{project}'
252           branch: '{branch}'
253           stream: '{stream}'
254           lftools-version: '{lftools-version}'
255       - string:
256           name: ARCHIVE_ARTIFACTS
257           default: '{archive-artifacts}'
258           description: Artifacts to archive to the logs server.
259       - string:
260           name: MVN
261           # Sets an env var for shell scripts to be able to call the dynamically
262           # installed maven without having to calculate the path themselves.
263           # yamllint disable-line rule:line-length
264           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn'
265           description: 'Maven selector to be used by shell scripts'
266       - string:
267           name: SONAR_MAVEN_GOAL
268           default: '{sonar-mvn-goal}'
269           description: |
270               Maven goals to pass to the Sonar call. Typically sonar:sonar
271               however to use a specific version of the sonar-maven-plugin we
272               can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
273
274     builders:
275       - lf-infra-pre-build
276       - lf-infra-tox-install:
277           python-version: '{python-version}'
278       - shell: !include-raw-escape: ../shell/tox-run.sh
279       - lf-provide-maven-settings:
280           global-settings-file: '{mvn-global-settings}'
281           settings-file: '{mvn-settings}'
282       - lf-infra-tox-sonar:
283           java-version: '{java-version}'
284           mvn-settings: '{mvn-settings}'
285           mvn-version: '{mvn-version}'
286
287     publishers:
288       - lf-infra-publish
289
290 - builder:
291     name: lf-infra-tox-sonar
292     # Run a Sonar build with Maven
293     builders:
294       - lf-maven-install:
295           mvn-version: '{mvn-version}'
296       - lf-update-java-alternatives:
297           java-version: '{java-version}'
298       - inject:
299           # TODO: Switch this to the sonar wrapper when JJB 2.0 is available
300           properties-content: SONAR_HOST_URL=$SONAR_URL
301       - shell: !include-raw-escape:
302           - ../shell/common-variables.sh
303           - ../shell/maven-sonar.sh
304       - lf-provide-maven-settings-cleanup
305
306 - job-template:
307     name: '{project-name}-tox-sonar'
308     id: gerrit-tox-sonar
309     <<: *lf_python_common
310     # yamllint disable-line rule:key-duplicates
311     <<: *lf_tox_sonar
312
313     ######################
314     # Default parameters #
315     ######################
316
317     gerrit_sonar_triggers:
318       - comment-added-contains-event:
319           comment-contains-value: run-sonar$
320
321     #####################
322     # Job Configuration #
323     #####################
324
325     scm:
326       - lf-infra-gerrit-scm:
327           jenkins-ssh-credential: '{jenkins-ssh-credential}'
328           git-url: '{git-url}'
329           refspec: $GERRIT_REFSPEC
330           branch: $GERRIT_BRANCH
331           submodule-recursive: '{submodule-recursive}'
332           submodule-timeout: '{submodule-timeout}'
333           choosing-strategy: default
334
335     triggers:
336       - timed: '{obj:cron}'
337       - gerrit:
338           server-name: '{gerrit-server-name}'
339           trigger-on: '{obj:gerrit_sonar_triggers}'
340           projects:
341             - project-compare-type: 'ANT'
342               project-pattern: '{project}'
343               branches:
344                 - branch-compare-type: 'ANT'
345                   branch-pattern: '**/{branch}'
346               file-paths: '{obj:gerrit_trigger_file_paths}'
347           skip-vote:
348             successful: true
349             failed: true
350             unstable: true
351             notbuilt: true
352
353 - job-template:
354     name: '{project-name}-tox-sonar'
355     id: github-tox-sonar
356     <<: *lf_python_common
357     # yamllint disable-line rule:key-duplicates
358     <<: *lf_tox_sonar
359
360     properties:
361       - lf-infra-properties:
362           build-days-to-keep: '{build-days-to-keep}'
363       - github:
364           url: '{github-url}/{github-org}/{project}'
365
366     scm:
367       - lf-infra-github-scm:
368           url: '{git-clone-url}{github-org}/{project}'
369           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
370           branch: '$sha1'
371           submodule-recursive: '{submodule-recursive}'
372           submodule-timeout: '{submodule-timeout}'
373           choosing-strategy: default
374           jenkins-ssh-credential: '{jenkins-ssh-credential}'
375
376     triggers:
377       - github-pull-request:
378           trigger-phrase: '^run-sonar$'
379           only-trigger-phrase: false
380           status-context: 'Python Sonar'
381           permit-all: true
382           github-hooks: true
383           white-list-target-branches:
384             - '{branch}'
385           included-regions: '{obj:github_included_regions}'
386
387 ##############
388 # Tox Verify #
389 ##############
390
391 - lf_tox_verify: &lf_tox_verify
392     name: lf-tox-verify
393
394     ######################
395     # Default parameters #
396     ######################
397
398     branch: master
399     build-days-to-keep: 7
400     build-timeout: 15
401     disable-job: false
402     git-url: '$GIT_URL/$GERRIT_PROJECT'
403     github-url: 'https://github.com'
404     parallel: true
405     python-version: python2
406     stream: master
407     submodule-recursive: true
408     submodule-timeout: 10
409     tox-dir: ''
410     tox-envs: ''
411
412     gerrit_trigger_file_paths:
413       - compare-type: REG_EXP
414         pattern: '.*'
415
416     # github_included_regions MUST match gerrit_trigger_file_paths
417     github_included_regions:
418       - '.*'
419
420     #####################
421     # Job Configuration #
422     #####################
423
424     project-type: freestyle
425     node: '{build-node}'
426     concurrent: true
427     disabled: '{disable-job}'
428
429     properties:
430       - lf-infra-properties:
431           build-days-to-keep: '{build-days-to-keep}'
432
433     parameters:
434       - lf-infra-parameters:
435           project: '{project}'
436           branch: '{branch}'
437           stream: '{stream}'
438           lftools-version: '{lftools-version}'
439       - lf-infra-tox-parameters:
440           tox-dir: '{tox-dir}'
441           tox-envs: '{tox-envs}'
442       - bool:
443           name: PARALLEL
444           default: '{parallel}'
445           description: Tox test type used to configure serial or parallel testing.
446
447     wrappers:
448       - lf-infra-wrappers:
449           build-timeout: '{build-timeout}'
450           jenkins-ssh-credential: '{jenkins-ssh-credential}'
451
452     builders:
453       - lf-infra-pre-build
454       - lf-infra-tox-install:
455           python-version: '{python-version}'
456       - shell: !include-raw-escape: ../shell/tox-run.sh
457
458     publishers:
459       - lf-infra-publish
460
461 - job-template:
462     # Python projects typically use tox to run testing.
463     name: '{project-name}-tox-verify-{stream}'
464     id: gerrit-tox-verify
465     <<: *lf_tox_verify
466
467     ######################
468     # Default parameters #
469     ######################
470
471     gerrit_verify_triggers:
472       - patchset-created-event:
473           exclude-drafts: true
474           exclude-trivial-rebase: false
475           exclude-no-code-change: false
476       - draft-published-event
477       - comment-added-contains-event:
478           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
479
480     #####################
481     # Job Configuration #
482     #####################
483
484     scm:
485       - lf-infra-gerrit-scm:
486           jenkins-ssh-credential: '{jenkins-ssh-credential}'
487           git-url: '{git-url}'
488           refspec: '$GERRIT_REFSPEC'
489           branch: '$GERRIT_BRANCH'
490           submodule-recursive: '{submodule-recursive}'
491           submodule-timeout: '{submodule-timeout}'
492           choosing-strategy: gerrit
493
494     triggers:
495       - gerrit:
496           server-name: '{gerrit-server-name}'
497           trigger-on: '{obj:gerrit_verify_triggers}'
498           projects:
499             - project-compare-type: ANT
500               project-pattern: '{project}'
501               branches:
502                 - branch-compare-type: ANT
503                   branch-pattern: '**/{branch}'
504               file-paths: '{obj:gerrit_trigger_file_paths}'
505
506 - job-template:
507     # Python projects typically use tox to run testing.
508     name: '{project-name}-tox-verify-{stream}'
509     id: github-tox-verify
510     <<: *lf_tox_verify
511
512     properties:
513       - lf-infra-properties:
514           build-days-to-keep: '{build-days-to-keep}'
515       - github:
516           url: '{github-url}/{github-org}/{project}'
517
518     scm:
519       - lf-infra-github-scm:
520           url: '{git-clone-url}{github-org}/{project}'
521           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
522           branch: '$sha1'
523           submodule-recursive: '{submodule-recursive}'
524           submodule-timeout: '{submodule-timeout}'
525           choosing-strategy: default
526           jenkins-ssh-credential: '{jenkins-ssh-credential}'
527
528     triggers:
529       - github-pull-request:
530           trigger-phrase: '^(recheck|reverify)$'
531           only-trigger-phrase: false
532           status-context: 'Tox Verify'
533           permit-all: true
534           github-hooks: true
535           white-list-target-branches:
536             - '{branch}'
537           included-regions: '{obj:github_included_regions}'