df82d8fd20de3a76d5316d5ca23eea7f2c921435
[releng/global-jjb.git] / jjb / lf-python-jobs.yaml
1 ---
2 ##########
3 # Macros #
4 ##########
5
6 - builder:
7     name: lf-infra-clm-python
8     builders:
9       - inject:
10           properties-content: "CLM_PROJECT_NAME={clm-project-name}"
11       - shell: !include-raw-escape: ../shell/nexus-iq-cli.sh
12
13 - builder:
14     name: lf-infra-pypi-tag-release
15     builders:
16       - config-file-provider:
17           files:
18             - file-id: sigul-config
19               variable: SIGUL_CONFIG
20             - file-id: sigul-password
21               variable: SIGUL_PASSWORD
22             - file-id: sigul-pki
23               variable: SIGUL_PKI
24             - file-id: signing-pubkey
25               variable: SIGNING_PUBKEY
26       - shell: !include-raw: ../shell/sigul-configuration.sh
27       - shell: !include-raw: ../shell/sigul-install.sh
28       - shell: !include-raw: ../shell/pypi-tag-release.sh
29
30 - builder:
31     name: lf-infra-pypi-upload
32     builders:
33       - config-file-provider:
34           files:
35             - file-id: pypirc
36               target: "$HOME/.pypirc"
37       - inject:
38           properties-content: "REPOSITORY={pypi-repo}"
39       - shell: !include-raw-escape: ../shell/pypi-upload.sh
40
41 - builder:
42     name: lf-infra-tox-install
43     builders:
44       - inject:
45           properties-content: "PYTHON={python-version}"
46       - shell: !include-raw-escape: ../shell/tox-install.sh
47
48 - builder:
49     name: lf-infra-tox-run
50     builders:
51       - inject:
52           properties-content: "PARALLEL={parallel}"
53       - shell: !include-raw-escape: ../shell/tox-run.sh
54
55 ####################
56 # COMMON FUNCTIONS #
57 ####################
58
59 - lf_python_common: &lf_python_common
60     name: lf-python-common
61
62     ######################
63     # Default parameters #
64     ######################
65
66     archive-artifacts: >
67       **/*.log
68
69     #####################
70     # Job Configuration #
71     #####################
72
73     project-type: freestyle
74     node: "{build-node}"
75
76     properties:
77       - lf-infra-properties:
78           build-days-to-keep: "{build-days-to-keep}"
79
80     parameters:
81       - lf-infra-parameters:
82           project: "{project}"
83           branch: "{branch}"
84           stream: "{stream}"
85
86     wrappers:
87       - lf-infra-wrappers:
88           build-timeout: "{build-timeout}"
89           jenkins-ssh-credential: "{jenkins-ssh-credential}"
90
91     publishers:
92       - lf-infra-publish
93
94 #################
95 # Python XC CLM #
96 #################
97
98 - lf_python_clm_xc: &lf_python_xc_clm
99     name: lf-python-xc-clm
100
101     ######################
102     # Default parameters #
103     ######################
104
105     branch: master
106     build-days-to-keep: 30 # 30 days for troubleshooting purposes
107     build-timeout: 60
108     disable-job: false
109     git-url: "$GIT_URL/$PROJECT"
110     github-url: "https://github.com"
111     java-version: openjdk8
112     nexus-iq-cli-version: 1.44.0-01
113     nexus-iq-namespace: "" # Recommend a trailing dash when set. Example: odl-
114     pre-build-script: "# pre-build script goes here"
115     stream: master
116     submodule-recursive: true
117     submodule-timeout: 10
118     submodule-disable: false
119
120     gerrit_trigger_file_paths:
121       - compare-type: ANT
122         pattern: ".*"
123
124     # github_included_regions MUST match gerrit_trigger_file_paths
125     github_included_regions:
126       - ".*"
127
128     #####################
129     # Job Configuration #
130     #####################
131
132     disabled: "{disable-job}"
133
134     parameters:
135       - lf-infra-parameters:
136           project: "{project}"
137           branch: "{branch}"
138           stream: "{stream}"
139       - string:
140           name: NEXUS_IQ_CLI_VERSION
141           default: "{nexus-iq-cli-version}"
142           description: Nexus IQ CLI package to download and use.
143
144     wrappers:
145       - credentials-binding:
146           - username-password-separated:
147               credential-id: nexus-iq-xc-clm
148               username: CLM_USER
149               password: CLM_PASSWORD
150     builders:
151       - lf-update-java-alternatives:
152           java-version: "{java-version}"
153       - shell: "{pre-build-script}"
154       - lf-infra-clm-python:
155           clm-project-name: "{nexus-iq-namespace}{project-name}"
156
157 - job-template:
158     name: "{project-name}-python-clm-{stream}"
159     id: gerrit-python-xc-clm
160     <<: *lf_python_common
161     # yamllint disable-line rule:key-duplicates
162     <<: *lf_python_xc_clm
163
164     ######################
165     # Default parameters #
166     ######################
167
168     gerrit_clm_triggers:
169       - comment-added-contains-event:
170           comment-contains-value: '^Patch Set\s+\d+:\s+run-clm\s*$'
171
172     #####################
173     # Job Configuration #
174     #####################
175
176     scm:
177       - lf-infra-gerrit-scm:
178           jenkins-ssh-credential: "{jenkins-ssh-credential}"
179           git-url: "{git-url}"
180           refspec: "$GERRIT_REFSPEC"
181           branch: "$GERRIT_BRANCH"
182           submodule-recursive: "{submodule-recursive}"
183           submodule-timeout: "{submodule-timeout}"
184           submodule-disable: "{submodule-disable}"
185           choosing-strategy: default
186
187     triggers:
188       # Build weekly on Saturdays
189       - timed: "H H * * 6"
190       - gerrit:
191           server-name: "{gerrit-server-name}"
192           trigger-on: "{obj:gerrit_clm_triggers}"
193           projects:
194             - project-compare-type: ANT
195               project-pattern: "{project}"
196               branches:
197                 - branch-compare-type: ANT
198                   branch-pattern: "**/{branch}"
199               file-paths: "{obj:gerrit_trigger_file_paths}"
200           skip-vote:
201             successful: true
202             failed: true
203             unstable: true
204             notbuilt: true
205
206 - job-template:
207     name: "{project-name}-python-clm-{stream}"
208     id: github-python-xc-clm
209     <<: *lf_python_common
210     # yamllint disable-line rule:key-duplicates
211     <<: *lf_python_xc_clm
212
213     properties:
214       - lf-infra-properties:
215           build-days-to-keep: "{build-days-to-keep}"
216       - github:
217           url: "{github-url}/{github-org}/{project}"
218
219     scm:
220       - lf-infra-github-scm:
221           url: "{git-clone-url}{github-org}/{project}"
222           refspec: ""
223           branch: "refs/heads/{branch}"
224           submodule-recursive: "{submodule-recursive}"
225           submodule-timeout: "{submodule-timeout}"
226           submodule-disable: "{submodule-disable}"
227           choosing-strategy: default
228           jenkins-ssh-credential: "{jenkins-ssh-credential}"
229
230     triggers:
231       # Build weekly on Saturdays
232       - timed: "H H * * 6"
233       - github-pull-request:
234           trigger-phrase: "^run-clm$"
235           only-trigger-phrase: false
236           status-context: "CLM"
237           permit-all: true
238           github-hooks: true
239           white-list-target-branches:
240             - "{branch}"
241           included-regions: "{obj:github_included_regions}"
242
243 #########################
244 # Python Sonar with Tox #
245 #########################
246
247 - lf_tox_sonar: &lf_tox_sonar
248     name: lf-tox_sonar
249
250     ######################
251     # Default parameters #
252     ######################
253
254     branch: master # Sonar should always be run on master branch
255     build-days-to-keep: 7
256     build-timeout: 60
257     cron: "H H * * *" # run daily
258     disable-job: false
259     git-url: "$GIT_URL/$PROJECT"
260     github-url: "https://github.com"
261     java-version: openjdk8
262     mvn-global-settings: global-settings
263     mvn-goals: validate
264     mvn-settings: "{mvn-settings}"
265     mvn-version: mvn35
266     parallel: true
267     pre-build-script: "# pre-build script goes here"
268     python-version: python3
269     sonar-mvn-goal: "sonar:sonar"
270     sonarcloud: false
271     sonarcloud-project-key: ""
272     sonarcloud-project-organization: ""
273     sonarcloud-api-token: ""
274     stream: master
275     submodule-recursive: true
276     submodule-timeout: 10
277     submodule-disable: false
278     tox-dir: "."
279     tox-envs: ""
280
281     gerrit_trigger_file_paths:
282       - compare-type: REG_EXP
283         pattern: ".*"
284
285     # github_included_regions MUST match gerrit_trigger_file_paths
286     github_included_regions:
287       - ".*"
288
289     #####################
290     # Job Configuration #
291     #####################
292
293     disabled: "{disable-job}"
294
295     parameters:
296       - lf-infra-parameters:
297           project: "{project}"
298           branch: "{branch}"
299           stream: "{stream}"
300       - lf-infra-tox-parameters:
301           tox-dir: "{tox-dir}"
302           tox-envs: "{tox-envs}"
303       - string:
304           name: ARCHIVE_ARTIFACTS
305           default: "{archive-artifacts}"
306           description: Artifacts to archive to the logs server.
307       - string:
308           name: MVN
309           # Sets an env var for shell scripts to be able to call the dynamically
310           # installed maven without having to calculate the path themselves.
311           # yamllint disable-line rule:line-length
312           default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
313           description: "Maven selector to be used by shell scripts"
314       - string:
315           name: SONAR_MAVEN_GOAL
316           default: "{sonar-mvn-goal}"
317           description: |
318             Maven goals to pass to the Sonar call. Typically sonar:sonar
319             however to use a specific version of the sonar-maven-plugin we
320             can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
321
322     builders:
323       - lf-infra-pre-build
324       - lf-infra-tox-install:
325           python-version: "{python-version}"
326       - shell: "{pre-build-script}"
327       - lf-infra-tox-run:
328           parallel: "{parallel}"
329       - lf-provide-maven-settings:
330           global-settings-file: "{mvn-global-settings}"
331           settings-file: "{mvn-settings}"
332       # With SonarCloud
333       - conditional-step:
334           condition-kind: boolean-expression
335           condition-expression: "{sonarcloud}"
336           steps:
337             - shell: echo 'Using SonarCloud'
338             - lf-infra-maven-sonarcloud:
339                 java-version: "{java-version}"
340                 mvn-goals: "{mvn-goals}"
341                 mvn-settings: "{mvn-settings}"
342                 mvn-version: "{mvn-version}"
343                 sonarcloud-project-key: "{sonarcloud-project-key}"
344                 sonarcloud-project-organization: "{sonarcloud-project-organization}"
345                 sonarcloud-api-token: "{sonarcloud-api-token}"
346       # With SonarQube
347       - conditional-step:
348           condition-kind: not
349           condition-operand:
350             condition-kind: boolean-expression
351             condition-expression: "{sonarcloud}"
352           steps:
353             - shell: echo 'Using SonarQube'
354             - lf-infra-maven-sonar:
355                 java-version: "{java-version}"
356                 mvn-goals: "{mvn-goals}"
357                 mvn-settings: "{mvn-settings}"
358                 mvn-version: "{mvn-version}"
359
360     publishers:
361       - lf-infra-publish
362
363 - job-template:
364     name: "{project-name}-tox-sonar"
365     id: gerrit-tox-sonar
366     <<: *lf_python_common
367     # yamllint disable-line rule:key-duplicates
368     <<: *lf_tox_sonar
369
370     ######################
371     # Default parameters #
372     ######################
373
374     gerrit_sonar_triggers:
375       - comment-added-contains-event:
376           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
377
378     #####################
379     # Job Configuration #
380     #####################
381
382     scm:
383       - lf-infra-gerrit-scm:
384           jenkins-ssh-credential: "{jenkins-ssh-credential}"
385           git-url: "{git-url}"
386           refspec: $GERRIT_REFSPEC
387           branch: $GERRIT_BRANCH
388           submodule-recursive: "{submodule-recursive}"
389           submodule-timeout: "{submodule-timeout}"
390           submodule-disable: "{submodule-disable}"
391           choosing-strategy: default
392
393     triggers:
394       - timed: "{obj:cron}"
395       - gerrit:
396           server-name: "{gerrit-server-name}"
397           trigger-on: "{obj:gerrit_sonar_triggers}"
398           projects:
399             - project-compare-type: "ANT"
400               project-pattern: "{project}"
401               branches:
402                 - branch-compare-type: "ANT"
403                   branch-pattern: "**/{branch}"
404               file-paths: "{obj:gerrit_trigger_file_paths}"
405           skip-vote:
406             successful: true
407             failed: true
408             unstable: true
409             notbuilt: true
410
411 - job-template:
412     name: "{project-name}-tox-sonar"
413     id: github-tox-sonar
414     <<: *lf_python_common
415     # yamllint disable-line rule:key-duplicates
416     <<: *lf_tox_sonar
417
418     properties:
419       - lf-infra-properties:
420           build-days-to-keep: "{build-days-to-keep}"
421       - github:
422           url: "{github-url}/{github-org}/{project}"
423
424     scm:
425       - lf-infra-github-scm:
426           url: "{git-clone-url}{github-org}/{project}"
427           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
428           branch: "$sha1"
429           submodule-recursive: "{submodule-recursive}"
430           submodule-timeout: "{submodule-timeout}"
431           submodule-disable: "{submodule-disable}"
432           choosing-strategy: default
433           jenkins-ssh-credential: "{jenkins-ssh-credential}"
434
435     triggers:
436       - github-pull-request:
437           trigger-phrase: "^run-sonar$"
438           only-trigger-phrase: false
439           status-context: "Python Sonar"
440           permit-all: true
441           github-hooks: true
442           white-list-target-branches:
443             - "{branch}"
444           included-regions: "{obj:github_included_regions}"
445
446 ##############
447 # Tox Common #
448 ##############
449
450 - lf_tox_common: &lf_tox_common
451     name: lf-tox-common
452
453     ######################
454     # Default parameters #
455     ######################
456
457     branch: master
458     build-days-to-keep: 7
459     build-timeout: 15
460     disable-job: false
461     git-url: "$GIT_URL/$GERRIT_PROJECT"
462     github-url: "https://github.com"
463     parallel: false
464     pre-build-script: "# pre-build script goes here"
465     python-version: python3
466     stream: master
467     submodule-recursive: true
468     submodule-timeout: 10
469     submodule-disable: false
470     tox-dir: "."
471     tox-envs: ""
472
473     gerrit_trigger_file_paths:
474       - compare-type: REG_EXP
475         pattern: ".*"
476
477     # github_included_regions MUST match gerrit_trigger_file_paths
478     github_included_regions:
479       - ".*"
480
481     #####################
482     # Job Configuration #
483     #####################
484
485     project-type: freestyle
486     node: "{build-node}"
487     concurrent: true
488     disabled: "{disable-job}"
489
490     properties:
491       - lf-infra-properties:
492           build-days-to-keep: "{build-days-to-keep}"
493
494     parameters:
495       - lf-infra-parameters:
496           project: "{project}"
497           branch: "{branch}"
498           stream: "{stream}"
499       - lf-infra-tox-parameters:
500           tox-dir: "{tox-dir}"
501           tox-envs: "{tox-envs}"
502
503     wrappers:
504       - lf-infra-wrappers:
505           build-timeout: "{build-timeout}"
506           jenkins-ssh-credential: "{jenkins-ssh-credential}"
507
508     builders:
509       - lf-infra-pre-build
510       - lf-infra-tox-install:
511           python-version: "{python-version}"
512       - shell: "{pre-build-script}"
513       - lf-infra-tox-run:
514           parallel: "{parallel}"
515
516     publishers:
517       - lf-infra-publish
518
519 - job-template:
520     # Python projects typically use tox to run testing.
521     name: "{project-name}-tox-verify-{stream}"
522     id: gerrit-tox-verify
523     <<: *lf_tox_common
524
525     ######################
526     # Default parameters #
527     ######################
528
529     gerrit-skip-vote: false
530     gerrit_verify_triggers:
531       - patchset-created-event:
532           exclude-drafts: true
533           exclude-trivial-rebase: false
534           exclude-no-code-change: false
535       - draft-published-event
536       - comment-added-contains-event:
537           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
538
539     #####################
540     # Job Configuration #
541     #####################
542
543     scm:
544       - lf-infra-gerrit-scm:
545           jenkins-ssh-credential: "{jenkins-ssh-credential}"
546           git-url: "{git-url}"
547           refspec: "$GERRIT_REFSPEC"
548           branch: "$GERRIT_BRANCH"
549           submodule-recursive: "{submodule-recursive}"
550           submodule-timeout: "{submodule-timeout}"
551           submodule-disable: "{submodule-disable}"
552           choosing-strategy: gerrit
553
554     triggers:
555       - gerrit:
556           server-name: "{gerrit-server-name}"
557           trigger-on: "{obj:gerrit_verify_triggers}"
558           projects:
559             - project-compare-type: ANT
560               project-pattern: "{project}"
561               branches:
562                 - branch-compare-type: ANT
563                   branch-pattern: "**/{branch}"
564               file-paths: "{obj:gerrit_trigger_file_paths}"
565           skip-vote:
566             successful: "{gerrit-skip-vote}"
567             failed: "{gerrit-skip-vote}"
568             unstable: "{gerrit-skip-vote}"
569             notbuilt: "{gerrit-skip-vote}"
570
571 - job-template:
572     # Python projects typically use tox to run testing.
573     name: "{project-name}-tox-verify-{stream}"
574     id: github-tox-verify
575     <<: *lf_tox_common
576
577     properties:
578       - lf-infra-properties:
579           build-days-to-keep: "{build-days-to-keep}"
580       - github:
581           url: "{github-url}/{github-org}/{project}"
582
583     scm:
584       - lf-infra-github-scm:
585           url: "{git-clone-url}{github-org}/{project}"
586           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
587           branch: "$sha1"
588           submodule-recursive: "{submodule-recursive}"
589           submodule-timeout: "{submodule-timeout}"
590           submodule-disable: "{submodule-disable}"
591           choosing-strategy: default
592           jenkins-ssh-credential: "{jenkins-ssh-credential}"
593
594     triggers:
595       - github-pull-request:
596           trigger-phrase: "^(recheck|reverify)$"
597           only-trigger-phrase: false
598           status-context: "Tox Verify"
599           permit-all: true
600           github-hooks: true
601           white-list-target-branches:
602             - "{branch}"
603           included-regions: "{obj:github_included_regions}"
604
605 - job-template:
606     # Run tox after merge of gerrit change set
607     name: "{project-name}-tox-merge-{stream}"
608     id: gerrit-tox-merge
609     <<: *lf_tox_common
610
611     ######################
612     # Default parameters #
613     ######################
614
615     gerrit_merge_triggers:
616       - change-merged-event
617       - comment-added-contains-event:
618           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
619
620     #####################
621     # Job Configuration #
622     #####################
623
624     scm:
625       - lf-infra-gerrit-scm:
626           jenkins-ssh-credential: "{jenkins-ssh-credential}"
627           git-url: "{git-url}"
628           refspec: "$GERRIT_REFSPEC"
629           branch: "$GERRIT_BRANCH"
630           submodule-recursive: "{submodule-recursive}"
631           submodule-timeout: "{submodule-timeout}"
632           submodule-disable: "{submodule-disable}"
633           choosing-strategy: gerrit
634
635     triggers:
636       - gerrit:
637           server-name: "{gerrit-server-name}"
638           trigger-on: "{obj:gerrit_merge_triggers}"
639           projects:
640             - project-compare-type: ANT
641               project-pattern: "{project}"
642               branches:
643                 - branch-compare-type: ANT
644                   branch-pattern: "**/{branch}"
645               file-paths: "{obj:gerrit_trigger_file_paths}"
646
647 - job-template:
648     # Run tox after merge of github pull request
649     name: "{project-name}-tox-merge-{stream}"
650     id: github-tox-merge
651     <<: *lf_tox_common
652
653     properties:
654       - lf-infra-properties:
655           build-days-to-keep: "{build-days-to-keep}"
656       - github:
657           url: "{github-url}/{github-org}/{project}"
658
659     scm:
660       - lf-infra-github-scm:
661           url: "{git-clone-url}{github-org}/{project}"
662           refspec: ""
663           branch: "refs/heads/{branch}"
664           submodule-recursive: "{submodule-recursive}"
665           submodule-timeout: "{submodule-timeout}"
666           submodule-disable: "{submodule-disable}"
667           choosing-strategy: default
668           jenkins-ssh-credential: "{jenkins-ssh-credential}"
669
670     triggers:
671       - github-pull-request:
672           trigger-phrase: "^remerge$"
673           only-trigger-phrase: true
674           status-context: "Tox Merge"
675           permit-all: true
676           github-hooks: true
677           org-list:
678             - "{github-org}"
679           white-list: "{obj:github_pr_whitelist}"
680           admin-list: "{obj:github_pr_admin_list}"
681           white-list-target-branches:
682             - "{branch}"
683           included-regions: "{obj:github_included_regions}"
684
685 ########
686 # PyPI #
687 ########
688
689 - lf_pypi_common: &lf_pypi_common
690     name: lf-pypi-common
691
692     ######################
693     # Default parameters #
694     ######################
695
696     branch: master
697     build-days-to-keep: 7
698     build-timeout: 15
699     disable-job: false
700     dist-binary: true
701     git-url: "$GIT_URL/$GERRIT_PROJECT"
702     github-url: "https://github.com"
703     parallel: false
704     pre-build-script: "# pre-build script goes here"
705     python-version: python3
706     stream: master
707     submodule-recursive: true
708     submodule-timeout: 10
709     submodule-disable: false
710     tox-dir: "."
711     tox-envs: ""
712
713     disabled: "{disable-job}"
714
715     gerrit_trigger_file_paths:
716       - compare-type: ANT
717         pattern: ".*"
718
719     # github_included_regions MUST match gerrit_trigger_file_paths
720     github_included_regions:
721       - ".*"
722
723     parameters:
724       - lf-infra-parameters:
725           project: "{project}"
726           branch: "{branch}"
727           stream: "{stream}"
728       - lf-infra-tox-parameters:
729           tox-dir: "{tox-dir}"
730           tox-envs: "{tox-envs}"
731       - bool:
732           name: BUILD_BDIST_WHEEL
733           default: "{dist-binary}"
734           description: "Set to True to build a wheel"
735       - bool:
736           name: DRY_RUN
737           default: false
738           description: |
739             If DRY_RUN is enabled artifacts are not published.
740
741 - lf_pypi_verify_builders: &lf_pypi_verify_builders
742     name: lf-pypi-verify-builders
743
744     builders:
745       - lf-infra-pre-build
746       - lf-infra-tox-install:
747           python-version: "{python-version}"
748       - shell: "{pre-build-script}"
749       - lf-infra-tox-run:
750           parallel: "{parallel}"
751       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
752
753 - lf_pypi_merge_builders: &lf_pypi_merge_builders
754     name: lf-pypi-merge-builders
755
756     builders:
757       - lf-infra-pre-build
758       - lf-infra-tox-install:
759           python-version: "{python-version}"
760       - shell: "{pre-build-script}"
761       - lf-infra-tox-run:
762           parallel: "{parallel}"
763       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
764       - lf-infra-pypi-upload:
765           pypi-repo: "{pypi-repo}"
766
767 - lf_pypi_release_verify_builders: &lf_pypi_release_verify_builders
768     name: lf-pypi-release-verify-builders
769
770     builders:
771       - lf-infra-pre-build
772       - lf-infra-tox-install:
773           python-version: "{python-version}"
774       - shell: "{pre-build-script}"
775       - lf-infra-tox-run:
776           parallel: "{parallel}"
777       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
778       - lf-infra-pypi-tag-release
779
780 - lf_pypi_release_merge_builders: &lf_pypi_release_merge_builders
781     name: lf-pypi-release-merge-builders
782
783     builders:
784       - lf-infra-pre-build
785       - lf-infra-tox-install:
786           python-version: "{python-version}"
787       - shell: "{pre-build-script}"
788       - lf-infra-tox-run:
789           parallel: "{parallel}"
790       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
791       - lf-infra-pypi-tag-release
792       - lf-infra-pypi-upload:
793           pypi-repo: "{pypi-repo}"
794
795 - job-template:
796     name: "{project-name}-pypi-verify-{stream}"
797     id: gerrit-pypi-verify
798     <<: *lf_python_common
799     # yamllint disable-line rule:key-duplicates
800     <<: *lf_pypi_common
801     <<: *lf_pypi_verify_builders
802
803     gerrit_verify_triggers:
804       - patchset-created-event:
805           exclude-drafts: true
806           exclude-trivial-rebase: false
807           exclude-no-code-change: false
808       - draft-published-event
809       - comment-added-contains-event:
810           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
811
812     scm:
813       - lf-infra-gerrit-scm:
814           jenkins-ssh-credential: "{jenkins-ssh-credential}"
815           git-url: "{git-url}"
816           refspec: "$GERRIT_REFSPEC"
817           branch: "$GERRIT_BRANCH"
818           submodule-recursive: "{submodule-recursive}"
819           submodule-timeout: "{submodule-timeout}"
820           submodule-disable: "{submodule-disable}"
821           choosing-strategy: gerrit
822
823     triggers:
824       - gerrit:
825           server-name: "{gerrit-server-name}"
826           trigger-on: "{obj:gerrit_verify_triggers}"
827           projects:
828             - project-compare-type: ANT
829               project-pattern: "{project}"
830               branches:
831                 - branch-compare-type: ANT
832                   branch-pattern: "**/{branch}"
833               file-paths: "{obj:gerrit_trigger_file_paths}"
834
835 - job-template:
836     name: "{project-name}-pypi-verify-{stream}"
837     id: github-pypi-verify
838     <<: *lf_python_common
839     # yamllint disable-line rule:key-duplicates
840     <<: *lf_pypi_common
841     <<: *lf_pypi_verify_builders
842
843     properties:
844       - github:
845           url: "{github-url}/{github-org}/{project}"
846
847     scm:
848       - lf-infra-github-scm:
849           url: "{git-clone-url}{github-org}/{project}"
850           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
851           branch: "$sha1"
852           submodule-recursive: "{submodule-recursive}"
853           submodule-timeout: "{submodule-timeout}"
854           submodule-disable: "{submodule-disable}"
855           choosing-strategy: default
856           jenkins-ssh-credential: "{jenkins-ssh-credential}"
857
858     triggers:
859       - github-pull-request:
860           trigger-phrase: "^(recheck|reverify)$"
861           only-trigger-phrase: false
862           status-context: "PyPI Verify"
863           permit-all: true
864           github-hooks: true
865           white-list-target-branches:
866             - "{branch}"
867           included-regions: "{obj:github_included_regions}"
868
869 - job-template:
870     name: "{project-name}-pypi-merge-{stream}"
871     id: gerrit-pypi-merge
872     <<: *lf_python_common
873     # yamllint disable-line rule:key-duplicates
874     <<: *lf_pypi_common
875     <<: *lf_pypi_merge_builders
876
877     cron: ""
878     pypi-repo: pypi-test
879
880     gerrit_merge_triggers:
881       - change-merged-event
882       - comment-added-contains-event:
883           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
884
885     scm:
886       - lf-infra-gerrit-scm:
887           jenkins-ssh-credential: "{jenkins-ssh-credential}"
888           git-url: "{git-url}"
889           refspec: "$GERRIT_REFSPEC"
890           branch: "$GERRIT_BRANCH"
891           submodule-recursive: "{submodule-recursive}"
892           submodule-timeout: "{submodule-timeout}"
893           submodule-disable: "{submodule-disable}"
894           choosing-strategy: gerrit
895
896     triggers:
897       - timed: "{obj:cron}"
898       - gerrit:
899           server-name: "{gerrit-server-name}"
900           trigger-on: "{obj:gerrit_merge_triggers}"
901           projects:
902             - project-compare-type: ANT
903               project-pattern: "{project}"
904               branches:
905                 - branch-compare-type: ANT
906                   branch-pattern: "**/{branch}"
907               file-paths: "{obj:gerrit_trigger_file_paths}"
908
909 - job-template:
910     name: "{project-name}-pypi-merge-{stream}"
911     id: github-pypi-merge
912     <<: *lf_python_common
913     # yamllint disable-line rule:key-duplicates
914     <<: *lf_pypi_common
915     <<: *lf_pypi_merge_builders
916
917     cron: ""
918     pypi-repo: pypi-test
919
920     properties:
921       - github:
922           url: "{github-url}/{github-org}/{project}"
923
924     scm:
925       - lf-infra-github-scm:
926           url: "{git-clone-url}{github-org}/{project}"
927           refspec: ""
928           branch: "refs/heads/{branch}"
929           submodule-recursive: "{submodule-recursive}"
930           submodule-timeout: "{submodule-timeout}"
931           submodule-disable: "{submodule-disable}"
932           choosing-strategy: default
933           jenkins-ssh-credential: "{jenkins-ssh-credential}"
934
935     triggers:
936       - timed: "{obj:cron}"
937       - github-pull-request:
938           trigger-phrase: "^remerge$"
939           only-trigger-phrase: false
940           status-context: "Merge"
941           permit-all: true
942           github-hooks: true
943           org-list:
944             - "{github-org}"
945           white-list: "{obj:github_pr_whitelist}"
946           admin-list: "{obj:github_pr_admin_list}"
947           white-list-target-branches:
948             - "{branch}"
949           included-regions: "{obj:github_included_regions}"
950
951 - lf_pypi_release_common: &lf_pypi_release_common
952     name: lf-pypi-release-common
953
954     dist-binary: true
955     pypi-repo: pypi
956     use-release-file: true
957
958     # define once and use twice; jobs MUST NOT override
959     gerrit_release_trigger_file_paths:
960       - compare-type: REG_EXP
961         pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
962
963     # github_release_included_regions MUST match gerrit_release_trigger_file_paths
964     github_release_included_regions:
965       - 'releases\/.*\.yaml'
966       - '.releases\/.*\.yaml'
967
968     parameters:
969       - lf-infra-parameters:
970           project: "{project}"
971           branch: "{branch}"
972           stream: "{stream}"
973       - lf-infra-tox-parameters:
974           tox-dir: "{tox-dir}"
975           tox-envs: "{tox-envs}"
976       - bool:
977           name: BUILD_BDIST_WHEEL
978           default: "{dist-binary}"
979           description: "Set to True to build a wheel"
980       - string:
981           name: VERSION
982           default: ""
983           description: "This is the version, example: 1.0.0"
984       - bool:
985           name: USE_RELEASE_FILE
986           default: "{use-release-file}"
987           description: "Set to False for job built with parameters"
988       - bool:
989           name: DRY_RUN
990           default: false
991           description: |
992             If DRY_RUN is enabled artifacts are not published.
993
994 - job-template:
995     name: "{project-name}-pypi-release-verify-{stream}"
996     id: gerrit-pypi-release-verify
997     <<: *lf_python_common
998     # yamllint disable-line rule:key-duplicates
999     <<: *lf_pypi_common
1000     <<: *lf_pypi_release_common
1001     <<: *lf_pypi_release_verify_builders
1002
1003     gerrit_verify_triggers:
1004       - patchset-created-event:
1005           exclude-drafts: true
1006           exclude-trivial-rebase: false
1007           exclude-no-code-change: false
1008       - draft-published-event
1009       - comment-added-contains-event:
1010           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1011
1012     scm:
1013       - lf-infra-gerrit-scm:
1014           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1015           git-url: "{git-url}"
1016           refspec: "$GERRIT_REFSPEC"
1017           branch: "$GERRIT_BRANCH"
1018           submodule-recursive: "{submodule-recursive}"
1019           submodule-timeout: "{submodule-timeout}"
1020           submodule-disable: "{submodule-disable}"
1021           choosing-strategy: gerrit
1022
1023     triggers:
1024       - gerrit:
1025           server-name: "{gerrit-server-name}"
1026           trigger-on: "{obj:gerrit_verify_triggers}"
1027           projects:
1028             - project-compare-type: "ANT"
1029               project-pattern: "{project}"
1030               branches:
1031                 - branch-compare-type: ANT
1032                   branch-pattern: "**/{branch}"
1033               file-paths: "{obj:gerrit_release_trigger_file_paths}"
1034
1035 - job-template:
1036     name: "{project-name}-pypi-release-verify-{stream}"
1037     id: github-pypi-release-verify
1038     <<: *lf_python_common
1039     # yamllint disable-line rule:key-duplicates
1040     <<: *lf_pypi_common
1041     <<: *lf_pypi_release_common
1042     <<: *lf_pypi_release_verify_builders
1043
1044     properties:
1045       - github:
1046           url: "{github-url}/{github-org}/{project}"
1047
1048     scm:
1049       - lf-infra-github-scm:
1050           url: "{git-clone-url}{github-org}/{project}"
1051           refspec: ""
1052           branch: "refs/heads/{branch}"
1053           submodule-recursive: "{submodule-recursive}"
1054           submodule-timeout: "{submodule-timeout}"
1055           submodule-disable: "{submodule-disable}"
1056           choosing-strategy: default
1057           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1058
1059     triggers:
1060       - github-pull-request:
1061           trigger-phrase: "^(recheck|reverify)$"
1062           only-trigger-phrase: false
1063           status-context: "PyPI Release Verify"
1064           permit-all: true
1065           github-hooks: true
1066           white-list-target-branches:
1067             - "{branch}"
1068           included-regions: "{obj:github_release_included_regions}"
1069
1070 - job-template:
1071     name: "{project-name}-pypi-release-merge-{stream}"
1072     id: gerrit-pypi-release-merge
1073     <<: *lf_python_common
1074     # yamllint disable-line rule:key-duplicates
1075     <<: *lf_pypi_common
1076     <<: *lf_pypi_release_common
1077     <<: *lf_pypi_release_merge_builders
1078
1079     gerrit_release_triggers:
1080       - change-merged-event
1081
1082     scm:
1083       - lf-infra-gerrit-scm:
1084           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1085           git-url: "{git-url}"
1086           refspec: "$GERRIT_REFSPEC"
1087           branch: "$GERRIT_BRANCH"
1088           submodule-recursive: "{submodule-recursive}"
1089           submodule-timeout: "{submodule-timeout}"
1090           submodule-disable: "{submodule-disable}"
1091           choosing-strategy: gerrit
1092
1093     triggers:
1094       - gerrit:
1095           server-name: "{gerrit-server-name}"
1096           trigger-on: "{obj:gerrit_release_triggers}"
1097           projects:
1098             - project-compare-type: "ANT"
1099               project-pattern: "{project}"
1100               branches:
1101                 - branch-compare-type: ANT
1102                   branch-pattern: "**/{branch}"
1103               file-paths: "{obj:gerrit_release_trigger_file_paths}"
1104
1105 - job-template:
1106     name: "{project-name}-pypi-release-merge-{stream}"
1107     id: github-pypi-release-merge
1108     <<: *lf_python_common
1109     # yamllint disable-line rule:key-duplicates
1110     <<: *lf_pypi_common
1111     <<: *lf_pypi_release_common
1112     <<: *lf_pypi_release_merge_builders
1113
1114     properties:
1115       - github:
1116           url: "{github-url}/{github-org}/{project}"
1117
1118     scm:
1119       - lf-infra-github-scm:
1120           url: "{git-clone-url}{github-org}/{project}"
1121           refspec: ""
1122           branch: "refs/heads/{branch}"
1123           submodule-recursive: "{submodule-recursive}"
1124           submodule-timeout: "{submodule-timeout}"
1125           submodule-disable: "{submodule-disable}"
1126           choosing-strategy: default
1127           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1128
1129     triggers:
1130       - github-pull-request:
1131           trigger-phrase: "^(remerge)$"
1132           only-trigger-phrase: false
1133           status-context: "PyPI Release Merge"
1134           permit-all: true
1135           github-hooks: true
1136           white-list-target-branches:
1137             - "{branch}"
1138           included-regions: "{obj:github_release_included_regions}"