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