Make sure that jjb-cleanup.sh allows unbound vars
[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       - lf-infra-pre-build
290       - lf-infra-tox-install:
291           python-version: '{python-version}'
292       - shell: !include-raw-escape: ../shell/tox-run.sh
293       - lf-provide-maven-settings:
294           global-settings-file: '{mvn-global-settings}'
295           settings-file: '{mvn-settings}'
296       - lf-infra-tox-sonar:
297           java-version: '{java-version}'
298           mvn-settings: '{mvn-settings}'
299           mvn-version: '{mvn-version}'
300
301     publishers:
302       - lf-infra-publish
303
304 - builder:
305     name: lf-infra-tox-sonar
306     # Run a Sonar build with Maven
307     builders:
308       - lf-maven-install:
309           mvn-version: '{mvn-version}'
310       - lf-update-java-alternatives:
311           java-version: '{java-version}'
312       - inject:
313           # TODO: Switch this to the sonar wrapper when JJB 2.0 is available
314           properties-content: SONAR_HOST_URL=$SONAR_URL
315       - shell: !include-raw-escape:
316           - ../shell/common-variables.sh
317           - ../shell/maven-sonar.sh
318       - lf-provide-maven-settings-cleanup
319
320 - job-template:
321     name: '{project-name}-tox-sonar'
322     id: gerrit-tox-sonar
323     <<: *lf_python_common
324     # yamllint disable-line rule:key-duplicates
325     <<: *lf_tox_sonar
326
327     ######################
328     # Default parameters #
329     ######################
330
331     gerrit_sonar_triggers:
332       - comment-added-contains-event:
333           comment-contains-value: run-sonar$
334
335     #####################
336     # Job Configuration #
337     #####################
338
339     scm:
340       - lf-infra-gerrit-scm:
341           jenkins-ssh-credential: '{jenkins-ssh-credential}'
342           git-url: '{git-url}'
343           refspec: $GERRIT_REFSPEC
344           branch: $GERRIT_BRANCH
345           submodule-recursive: '{submodule-recursive}'
346           choosing-strategy: default
347
348     triggers:
349       - timed: '{obj:cron}'
350       - gerrit:
351           server-name: '{gerrit-server-name}'
352           trigger-on: '{obj:gerrit_sonar_triggers}'
353           projects:
354             - project-compare-type: 'ANT'
355               project-pattern: '{project}'
356               branches:
357                 - branch-compare-type: 'ANT'
358                   branch-pattern: '**/{branch}'
359               file-paths: '{obj:gerrit_trigger_file_paths}'
360           skip-vote:
361             successful: true
362             failed: true
363             unstable: true
364             notbuilt: true
365
366 - job-template:
367     name: '{project-name}-tox-sonar'
368     id: github-tox-sonar
369     <<: *lf_python_common
370     # yamllint disable-line rule:key-duplicates
371     <<: *lf_tox_sonar
372
373     properties:
374       - lf-infra-properties:
375           build-days-to-keep: '{build-days-to-keep}'
376       - github:
377           url: '{github-url}/{github-org}/{project}'
378
379     scm:
380       - lf-infra-github-scm:
381           url: '{git-clone-url}{github-org}/{project}'
382           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
383           branch: '$sha1'
384           submodule-recursive: '{submodule-recursive}'
385           choosing-strategy: default
386           jenkins-ssh-credential: '{jenkins-ssh-credential}'
387
388     triggers:
389       - github-pull-request:
390           trigger-phrase: '^run-sonar$'
391           only-trigger-phrase: false
392           status-context: 'Python Sonar'
393           permit-all: true
394           github-hooks: true
395           white-list-target-branches:
396             - '{branch}'
397           included-regions: '{obj:github_included_regions}'
398
399 ##############
400 # Tox Verify #
401 ##############
402
403 - lf_tox_verify: &lf_tox_verify
404     name: lf-tox-verify
405
406     ######################
407     # Default parameters #
408     ######################
409
410     branch: master
411     build-days-to-keep: 7
412     build-timeout: 15
413     disable-job: false
414     git-url: '$GIT_URL/$GERRIT_PROJECT'
415     github-url: 'https://github.com'
416     parallel: true
417     python-version: python2
418     stream: master
419     submodule-recursive: true
420     tox-dir: ''
421     tox-envs: ''
422
423     gerrit_trigger_file_paths:
424       - compare-type: REG_EXP
425         pattern: '.*'
426
427     # github_included_regions MUST match gerrit_trigger_file_paths
428     github_included_regions:
429       - '.*'
430
431     #####################
432     # Job Configuration #
433     #####################
434
435     project-type: freestyle
436     node: '{build-node}'
437     concurrent: true
438     disabled: '{disable-job}'
439
440     properties:
441       - lf-infra-properties:
442           build-days-to-keep: '{build-days-to-keep}'
443
444     parameters:
445       - lf-infra-parameters:
446           project: '{project}'
447           branch: '{branch}'
448           stream: '{stream}'
449           lftools-version: '{lftools-version}'
450       - lf-infra-tox-parameters:
451           tox-dir: '{tox-dir}'
452           tox-envs: '{tox-envs}'
453       - bool:
454           name: PARALLEL
455           default: '{parallel}'
456           description: Tox test type used to configure serial or parallel testing.
457
458     wrappers:
459       - lf-infra-wrappers:
460           build-timeout: '{build-timeout}'
461           jenkins-ssh-credential: '{jenkins-ssh-credential}'
462
463     builders:
464       - lf-infra-pre-build
465       - lf-infra-tox-install:
466           python-version: '{python-version}'
467       - shell: !include-raw-escape: ../shell/tox-run.sh
468
469     publishers:
470       - lf-infra-publish
471
472 - job-template:
473     # Python projects typically use tox to run testing.
474     name: '{project-name}-tox-verify-{stream}'
475     id: gerrit-tox-verify
476     <<: *lf_tox_verify
477
478     ######################
479     # Default parameters #
480     ######################
481
482     gerrit_verify_triggers:
483       - patchset-created-event:
484           exclude-drafts: true
485           exclude-trivial-rebase: false
486           exclude-no-code-change: false
487       - draft-published-event
488       - comment-added-contains-event:
489           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
490
491     #####################
492     # Job Configuration #
493     #####################
494
495     scm:
496       - lf-infra-gerrit-scm:
497           jenkins-ssh-credential: '{jenkins-ssh-credential}'
498           git-url: '{git-url}'
499           refspec: '$GERRIT_REFSPEC'
500           branch: '$GERRIT_BRANCH'
501           submodule-recursive: '{submodule-recursive}'
502           choosing-strategy: gerrit
503
504     triggers:
505       - gerrit:
506           server-name: '{gerrit-server-name}'
507           trigger-on: '{obj:gerrit_verify_triggers}'
508           projects:
509             - project-compare-type: ANT
510               project-pattern: '{project}'
511               branches:
512                 - branch-compare-type: ANT
513                   branch-pattern: '**/{branch}'
514               file-paths: '{obj:gerrit_trigger_file_paths}'
515
516 - job-template:
517     # Python projects typically use tox to run testing.
518     name: '{project-name}-tox-verify-{stream}'
519     id: github-tox-verify
520     <<: *lf_tox_verify
521
522     properties:
523       - lf-infra-properties:
524           build-days-to-keep: '{build-days-to-keep}'
525       - github:
526           url: '{github-url}/{github-org}/{project}'
527
528     scm:
529       - lf-infra-github-scm:
530           url: '{git-clone-url}{github-org}/{project}'
531           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
532           branch: '$sha1'
533           submodule-recursive: '{submodule-recursive}'
534           choosing-strategy: default
535           jenkins-ssh-credential: '{jenkins-ssh-credential}'
536
537     triggers:
538       - github-pull-request:
539           trigger-phrase: '^(recheck|reverify)$'
540           only-trigger-phrase: false
541           status-context: 'Tox Verify'
542           permit-all: true
543           github-hooks: true
544           white-list-target-branches:
545             - '{branch}'
546           included-regions: '{obj:github_included_regions}'