Fix formatting to prettier style
[releng/global-jjb.git] / jjb / lf-python-jobs.yaml
1 ---
2 ##########
3 # Macros #
4 ##########
5
6 - builder:
7     name: lf-infra-tox-install
8     builders:
9       - inject:
10           properties-content: "PYTHON_VERSION={python-version}"
11       - shell: !include-raw-escape: ../shell/tox-install.sh
12
13 - builder:
14     name: lf-infra-clm-python
15     builders:
16       - inject:
17           properties-content: "CLM_PROJECT_NAME={clm-project-name}"
18       - shell: !include-raw-escape:
19           - ../shell/nexus-iq-cli.sh
20
21 ####################
22 # COMMON FUNCTIONS #
23 ####################
24
25 - lf_python_common: &lf_python_common
26     name: lf-python-common
27
28     ######################
29     # Default parameters #
30     ######################
31
32     archive-artifacts: >
33       **/*.log
34
35     #####################
36     # Job Configuration #
37     #####################
38
39     project-type: freestyle
40     node: "{build-node}"
41
42     properties:
43       - lf-infra-properties:
44           build-days-to-keep: "{build-days-to-keep}"
45
46     parameters:
47       - lf-infra-parameters:
48           project: "{project}"
49           branch: "{branch}"
50           stream: "{stream}"
51
52     wrappers:
53       - lf-infra-wrappers:
54           build-timeout: "{build-timeout}"
55           jenkins-ssh-credential: "{jenkins-ssh-credential}"
56
57     publishers:
58       - lf-infra-publish
59
60 #################
61 # Python XC CLM #
62 #################
63
64 - lf_python_clm_xc: &lf_python_xc_clm
65     name: lf-python-xc-clm
66
67     ######################
68     # Default parameters #
69     ######################
70
71     branch: master
72     build-days-to-keep: 30 # 30 days for troubleshooting purposes
73     build-timeout: 60
74     disable-job: false
75     git-url: "$GIT_URL/$PROJECT"
76     github-url: "https://github.com"
77     java-version: openjdk8
78     nexus-iq-cli-version: 1.44.0-01
79     nexus-iq-namespace: "" # Recommend a trailing dash when set. Example: odl-
80     stream: master
81     submodule-recursive: true
82     submodule-timeout: 10
83     submodule-disable: false
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: '^Patch Set\s+\d+:\s+run-clm\s*$'
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           submodule-disable: "{submodule-disable}"
149           choosing-strategy: default
150
151     triggers:
152       # Build weekly on Saturdays
153       - timed: "H H * * 6"
154       - gerrit:
155           server-name: "{gerrit-server-name}"
156           trigger-on: "{obj:gerrit_clm_triggers}"
157           projects:
158             - project-compare-type: ANT
159               project-pattern: "{project}"
160               branches:
161                 - branch-compare-type: ANT
162                   branch-pattern: "**/{branch}"
163               file-paths: "{obj:gerrit_trigger_file_paths}"
164           skip-vote:
165             successful: true
166             failed: true
167             unstable: true
168             notbuilt: true
169
170 - job-template:
171     name: "{project-name}-python-clm-{stream}"
172     id: github-python-xc-clm
173     <<: *lf_python_common
174     # yamllint disable-line rule:key-duplicates
175     <<: *lf_python_xc_clm
176
177     properties:
178       - lf-infra-properties:
179           build-days-to-keep: "{build-days-to-keep}"
180       - github:
181           url: "{github-url}/{github-org}/{project}"
182
183     scm:
184       - lf-infra-github-scm:
185           url: "{git-clone-url}{github-org}/{project}"
186           refspec: ""
187           branch: "refs/heads/{branch}"
188           submodule-recursive: "{submodule-recursive}"
189           submodule-timeout: "{submodule-timeout}"
190           submodule-disable: "{submodule-disable}"
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     submodule-disable: false
235
236     gerrit_trigger_file_paths:
237       - compare-type: REG_EXP
238         pattern: ".*"
239
240     # github_included_regions MUST match gerrit_trigger_file_paths
241     github_included_regions:
242       - ".*"
243
244     #####################
245     # Job Configuration #
246     #####################
247
248     disabled: "{disable-job}"
249
250     parameters:
251       - lf-infra-parameters:
252           project: "{project}"
253           branch: "{branch}"
254           stream: "{stream}"
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: '^Patch Set\s+\d+:\s+run-sonar\s*$'
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           submodule-disable: "{submodule-disable}"
334           choosing-strategy: default
335
336     triggers:
337       - timed: "{obj:cron}"
338       - gerrit:
339           server-name: "{gerrit-server-name}"
340           trigger-on: "{obj:gerrit_sonar_triggers}"
341           projects:
342             - project-compare-type: "ANT"
343               project-pattern: "{project}"
344               branches:
345                 - branch-compare-type: "ANT"
346                   branch-pattern: "**/{branch}"
347               file-paths: "{obj:gerrit_trigger_file_paths}"
348           skip-vote:
349             successful: true
350             failed: true
351             unstable: true
352             notbuilt: true
353
354 - job-template:
355     name: "{project-name}-tox-sonar"
356     id: github-tox-sonar
357     <<: *lf_python_common
358     # yamllint disable-line rule:key-duplicates
359     <<: *lf_tox_sonar
360
361     properties:
362       - lf-infra-properties:
363           build-days-to-keep: "{build-days-to-keep}"
364       - github:
365           url: "{github-url}/{github-org}/{project}"
366
367     scm:
368       - lf-infra-github-scm:
369           url: "{git-clone-url}{github-org}/{project}"
370           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
371           branch: "$sha1"
372           submodule-recursive: "{submodule-recursive}"
373           submodule-timeout: "{submodule-timeout}"
374           submodule-disable: "{submodule-disable}"
375           choosing-strategy: default
376           jenkins-ssh-credential: "{jenkins-ssh-credential}"
377
378     triggers:
379       - github-pull-request:
380           trigger-phrase: "^run-sonar$"
381           only-trigger-phrase: false
382           status-context: "Python Sonar"
383           permit-all: true
384           github-hooks: true
385           white-list-target-branches:
386             - "{branch}"
387           included-regions: "{obj:github_included_regions}"
388
389 ##############
390 # Tox Verify #
391 ##############
392
393 - lf_tox_verify: &lf_tox_verify
394     name: lf-tox-verify
395
396     ######################
397     # Default parameters #
398     ######################
399
400     branch: master
401     build-days-to-keep: 7
402     build-timeout: 15
403     disable-job: false
404     git-url: "$GIT_URL/$GERRIT_PROJECT"
405     github-url: "https://github.com"
406     parallel: true
407     python-version: python2
408     stream: master
409     submodule-recursive: true
410     submodule-timeout: 10
411     submodule-disable: false
412     tox-dir: ""
413     tox-envs: ""
414
415     gerrit_trigger_file_paths:
416       - compare-type: REG_EXP
417         pattern: ".*"
418
419     # github_included_regions MUST match gerrit_trigger_file_paths
420     github_included_regions:
421       - ".*"
422
423     #####################
424     # Job Configuration #
425     #####################
426
427     project-type: freestyle
428     node: "{build-node}"
429     concurrent: true
430     disabled: "{disable-job}"
431
432     properties:
433       - lf-infra-properties:
434           build-days-to-keep: "{build-days-to-keep}"
435
436     parameters:
437       - lf-infra-parameters:
438           project: "{project}"
439           branch: "{branch}"
440           stream: "{stream}"
441       - lf-infra-tox-parameters:
442           tox-dir: "{tox-dir}"
443           tox-envs: "{tox-envs}"
444       - bool:
445           name: PARALLEL
446           default: "{parallel}"
447           description: Tox test type used to configure serial or parallel testing.
448
449     wrappers:
450       - lf-infra-wrappers:
451           build-timeout: "{build-timeout}"
452           jenkins-ssh-credential: "{jenkins-ssh-credential}"
453
454     builders:
455       - lf-infra-pre-build
456       - lf-infra-tox-install:
457           python-version: "{python-version}"
458       - shell: !include-raw-escape: ../shell/tox-run.sh
459
460     publishers:
461       - lf-infra-publish
462
463 - job-template:
464     # Python projects typically use tox to run testing.
465     name: "{project-name}-tox-verify-{stream}"
466     id: gerrit-tox-verify
467     <<: *lf_tox_verify
468
469     ######################
470     # Default parameters #
471     ######################
472
473     gerrit-skip-vote: false
474     gerrit_verify_triggers:
475       - patchset-created-event:
476           exclude-drafts: true
477           exclude-trivial-rebase: false
478           exclude-no-code-change: false
479       - draft-published-event
480       - comment-added-contains-event:
481           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
482
483     #####################
484     # Job Configuration #
485     #####################
486
487     scm:
488       - lf-infra-gerrit-scm:
489           jenkins-ssh-credential: "{jenkins-ssh-credential}"
490           git-url: "{git-url}"
491           refspec: "$GERRIT_REFSPEC"
492           branch: "$GERRIT_BRANCH"
493           submodule-recursive: "{submodule-recursive}"
494           submodule-timeout: "{submodule-timeout}"
495           submodule-disable: "{submodule-disable}"
496           choosing-strategy: gerrit
497
498     triggers:
499       - gerrit:
500           server-name: "{gerrit-server-name}"
501           trigger-on: "{obj:gerrit_verify_triggers}"
502           projects:
503             - project-compare-type: ANT
504               project-pattern: "{project}"
505               branches:
506                 - branch-compare-type: ANT
507                   branch-pattern: "**/{branch}"
508               file-paths: "{obj:gerrit_trigger_file_paths}"
509           skip-vote:
510             successful: "{gerrit-skip-vote}"
511             failed: "{gerrit-skip-vote}"
512             unstable: "{gerrit-skip-vote}"
513             notbuilt: "{gerrit-skip-vote}"
514
515 - job-template:
516     # Python projects typically use tox to run testing.
517     name: "{project-name}-tox-verify-{stream}"
518     id: github-tox-verify
519     <<: *lf_tox_verify
520
521     properties:
522       - lf-infra-properties:
523           build-days-to-keep: "{build-days-to-keep}"
524       - github:
525           url: "{github-url}/{github-org}/{project}"
526
527     scm:
528       - lf-infra-github-scm:
529           url: "{git-clone-url}{github-org}/{project}"
530           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
531           branch: "$sha1"
532           submodule-recursive: "{submodule-recursive}"
533           submodule-timeout: "{submodule-timeout}"
534           submodule-disable: "{submodule-disable}"
535           choosing-strategy: default
536           jenkins-ssh-credential: "{jenkins-ssh-credential}"
537
538     triggers:
539       - github-pull-request:
540           trigger-phrase: "^(recheck|reverify)$"
541           only-trigger-phrase: false
542           status-context: "Tox Verify"
543           permit-all: true
544           github-hooks: true
545           white-list-target-branches:
546             - "{branch}"
547           included-regions: "{obj:github_included_regions}"