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