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