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