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