Add comment trigger to PyPI release merge template
[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     stream: master
271     submodule-recursive: true
272     submodule-timeout: 10
273     submodule-disable: false
274
275     gerrit_trigger_file_paths:
276       - compare-type: REG_EXP
277         pattern: ".*"
278
279     # github_included_regions MUST match gerrit_trigger_file_paths
280     github_included_regions:
281       - ".*"
282
283     #####################
284     # Job Configuration #
285     #####################
286
287     disabled: "{disable-job}"
288
289     parameters:
290       - lf-infra-parameters:
291           project: "{project}"
292           branch: "{branch}"
293           stream: "{stream}"
294       - string:
295           name: ARCHIVE_ARTIFACTS
296           default: "{archive-artifacts}"
297           description: Artifacts to archive to the logs server.
298       - string:
299           name: MVN
300           # Sets an env var for shell scripts to be able to call the dynamically
301           # installed maven without having to calculate the path themselves.
302           # yamllint disable-line rule:line-length
303           default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
304           description: "Maven selector to be used by shell scripts"
305       - string:
306           name: SONAR_MAVEN_GOAL
307           default: "{sonar-mvn-goal}"
308           description: |
309             Maven goals to pass to the Sonar call. Typically sonar:sonar
310             however to use a specific version of the sonar-maven-plugin we
311             can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
312
313     builders:
314       - lf-infra-pre-build
315       - lf-infra-tox-install:
316           python-version: "{python-version}"
317       - shell: "{pre-build-script}"
318       - lf-infra-tox-run:
319           parallel: "{parallel}"
320       - lf-provide-maven-settings:
321           global-settings-file: "{mvn-global-settings}"
322           settings-file: "{mvn-settings}"
323       - lf-infra-maven-sonar:
324           java-version: "{java-version}"
325           mvn-goals: "{mvn-goals}"
326           mvn-settings: "{mvn-settings}"
327           mvn-version: "{mvn-version}"
328
329     publishers:
330       - lf-infra-publish
331
332 - job-template:
333     name: "{project-name}-tox-sonar"
334     id: gerrit-tox-sonar
335     <<: *lf_python_common
336     # yamllint disable-line rule:key-duplicates
337     <<: *lf_tox_sonar
338
339     ######################
340     # Default parameters #
341     ######################
342
343     gerrit_sonar_triggers:
344       - comment-added-contains-event:
345           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
346
347     #####################
348     # Job Configuration #
349     #####################
350
351     scm:
352       - lf-infra-gerrit-scm:
353           jenkins-ssh-credential: "{jenkins-ssh-credential}"
354           git-url: "{git-url}"
355           refspec: $GERRIT_REFSPEC
356           branch: $GERRIT_BRANCH
357           submodule-recursive: "{submodule-recursive}"
358           submodule-timeout: "{submodule-timeout}"
359           submodule-disable: "{submodule-disable}"
360           choosing-strategy: default
361
362     triggers:
363       - timed: "{obj:cron}"
364       - gerrit:
365           server-name: "{gerrit-server-name}"
366           trigger-on: "{obj:gerrit_sonar_triggers}"
367           projects:
368             - project-compare-type: "ANT"
369               project-pattern: "{project}"
370               branches:
371                 - branch-compare-type: "ANT"
372                   branch-pattern: "**/{branch}"
373               file-paths: "{obj:gerrit_trigger_file_paths}"
374           skip-vote:
375             successful: true
376             failed: true
377             unstable: true
378             notbuilt: true
379
380 - job-template:
381     name: "{project-name}-tox-sonar"
382     id: github-tox-sonar
383     <<: *lf_python_common
384     # yamllint disable-line rule:key-duplicates
385     <<: *lf_tox_sonar
386
387     properties:
388       - lf-infra-properties:
389           build-days-to-keep: "{build-days-to-keep}"
390       - github:
391           url: "{github-url}/{github-org}/{project}"
392
393     scm:
394       - lf-infra-github-scm:
395           url: "{git-clone-url}{github-org}/{project}"
396           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
397           branch: "$sha1"
398           submodule-recursive: "{submodule-recursive}"
399           submodule-timeout: "{submodule-timeout}"
400           submodule-disable: "{submodule-disable}"
401           choosing-strategy: default
402           jenkins-ssh-credential: "{jenkins-ssh-credential}"
403
404     triggers:
405       - github-pull-request:
406           trigger-phrase: "^run-sonar$"
407           only-trigger-phrase: false
408           status-context: "Python Sonar"
409           permit-all: true
410           github-hooks: true
411           white-list-target-branches:
412             - "{branch}"
413           included-regions: "{obj:github_included_regions}"
414
415 ##############
416 # Tox Common #
417 ##############
418
419 - lf_tox_common: &lf_tox_common
420     name: lf-tox-common
421
422     ######################
423     # Default parameters #
424     ######################
425
426     branch: master
427     build-days-to-keep: 7
428     build-timeout: 15
429     disable-job: false
430     git-url: "$GIT_URL/$GERRIT_PROJECT"
431     github-url: "https://github.com"
432     parallel: false
433     pre-build-script: "# pre-build script goes here"
434     python-version: python3
435     stream: master
436     submodule-recursive: true
437     submodule-timeout: 10
438     submodule-disable: false
439     tox-dir: "."
440     tox-envs: ""
441
442     gerrit_trigger_file_paths:
443       - compare-type: REG_EXP
444         pattern: ".*"
445
446     # github_included_regions MUST match gerrit_trigger_file_paths
447     github_included_regions:
448       - ".*"
449
450     #####################
451     # Job Configuration #
452     #####################
453
454     project-type: freestyle
455     node: "{build-node}"
456     concurrent: true
457     disabled: "{disable-job}"
458
459     properties:
460       - lf-infra-properties:
461           build-days-to-keep: "{build-days-to-keep}"
462
463     parameters:
464       - lf-infra-parameters:
465           project: "{project}"
466           branch: "{branch}"
467           stream: "{stream}"
468       - lf-infra-tox-parameters:
469           tox-dir: "{tox-dir}"
470           tox-envs: "{tox-envs}"
471
472     wrappers:
473       - lf-infra-wrappers:
474           build-timeout: "{build-timeout}"
475           jenkins-ssh-credential: "{jenkins-ssh-credential}"
476
477     builders:
478       - lf-infra-pre-build
479       - lf-infra-tox-install:
480           python-version: "{python-version}"
481       - shell: "{pre-build-script}"
482       - lf-infra-tox-run:
483           parallel: "{parallel}"
484
485     publishers:
486       - lf-infra-publish
487
488 - job-template:
489     # Python projects typically use tox to run testing.
490     name: "{project-name}-tox-verify-{stream}"
491     id: gerrit-tox-verify
492     <<: *lf_tox_common
493
494     ######################
495     # Default parameters #
496     ######################
497
498     gerrit-skip-vote: false
499     gerrit_verify_triggers:
500       - patchset-created-event:
501           exclude-drafts: true
502           exclude-trivial-rebase: false
503           exclude-no-code-change: false
504       - draft-published-event
505       - comment-added-contains-event:
506           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
507
508     #####################
509     # Job Configuration #
510     #####################
511
512     scm:
513       - lf-infra-gerrit-scm:
514           jenkins-ssh-credential: "{jenkins-ssh-credential}"
515           git-url: "{git-url}"
516           refspec: "$GERRIT_REFSPEC"
517           branch: "$GERRIT_BRANCH"
518           submodule-recursive: "{submodule-recursive}"
519           submodule-timeout: "{submodule-timeout}"
520           submodule-disable: "{submodule-disable}"
521           choosing-strategy: gerrit
522
523     triggers:
524       - gerrit:
525           server-name: "{gerrit-server-name}"
526           trigger-on: "{obj:gerrit_verify_triggers}"
527           projects:
528             - project-compare-type: ANT
529               project-pattern: "{project}"
530               branches:
531                 - branch-compare-type: ANT
532                   branch-pattern: "**/{branch}"
533               file-paths: "{obj:gerrit_trigger_file_paths}"
534           skip-vote:
535             successful: "{gerrit-skip-vote}"
536             failed: "{gerrit-skip-vote}"
537             unstable: "{gerrit-skip-vote}"
538             notbuilt: "{gerrit-skip-vote}"
539
540 - job-template:
541     # Python projects typically use tox to run testing.
542     name: "{project-name}-tox-verify-{stream}"
543     id: github-tox-verify
544     <<: *lf_tox_common
545
546     properties:
547       - lf-infra-properties:
548           build-days-to-keep: "{build-days-to-keep}"
549       - github:
550           url: "{github-url}/{github-org}/{project}"
551
552     scm:
553       - lf-infra-github-scm:
554           url: "{git-clone-url}{github-org}/{project}"
555           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
556           branch: "$sha1"
557           submodule-recursive: "{submodule-recursive}"
558           submodule-timeout: "{submodule-timeout}"
559           submodule-disable: "{submodule-disable}"
560           choosing-strategy: default
561           jenkins-ssh-credential: "{jenkins-ssh-credential}"
562
563     triggers:
564       - github-pull-request:
565           trigger-phrase: "^(recheck|reverify)$"
566           only-trigger-phrase: false
567           status-context: "Tox Verify"
568           permit-all: true
569           github-hooks: true
570           white-list-target-branches:
571             - "{branch}"
572           included-regions: "{obj:github_included_regions}"
573
574 - job-template:
575     # Run tox after merge of gerrit change set
576     name: "{project-name}-tox-merge-{stream}"
577     id: gerrit-tox-merge
578     <<: *lf_tox_common
579
580     ######################
581     # Default parameters #
582     ######################
583
584     gerrit_merge_triggers:
585       - change-merged-event
586       - comment-added-contains-event:
587           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
588
589     #####################
590     # Job Configuration #
591     #####################
592
593     scm:
594       - lf-infra-gerrit-scm:
595           jenkins-ssh-credential: "{jenkins-ssh-credential}"
596           git-url: "{git-url}"
597           refspec: "$GERRIT_REFSPEC"
598           branch: "$GERRIT_BRANCH"
599           submodule-recursive: "{submodule-recursive}"
600           submodule-timeout: "{submodule-timeout}"
601           submodule-disable: "{submodule-disable}"
602           choosing-strategy: gerrit
603
604     triggers:
605       - gerrit:
606           server-name: "{gerrit-server-name}"
607           trigger-on: "{obj:gerrit_merge_triggers}"
608           projects:
609             - project-compare-type: ANT
610               project-pattern: "{project}"
611               branches:
612                 - branch-compare-type: ANT
613                   branch-pattern: "**/{branch}"
614               file-paths: "{obj:gerrit_trigger_file_paths}"
615
616 - job-template:
617     # Run tox after merge of github pull request
618     name: "{project-name}-tox-merge-{stream}"
619     id: github-tox-merge
620     <<: *lf_tox_common
621
622     properties:
623       - lf-infra-properties:
624           build-days-to-keep: "{build-days-to-keep}"
625       - github:
626           url: "{github-url}/{github-org}/{project}"
627
628     scm:
629       - lf-infra-github-scm:
630           url: "{git-clone-url}{github-org}/{project}"
631           refspec: ""
632           branch: "refs/heads/{branch}"
633           submodule-recursive: "{submodule-recursive}"
634           submodule-timeout: "{submodule-timeout}"
635           submodule-disable: "{submodule-disable}"
636           choosing-strategy: default
637           jenkins-ssh-credential: "{jenkins-ssh-credential}"
638
639     triggers:
640       - github-pull-request:
641           trigger-phrase: "^remerge$"
642           only-trigger-phrase: true
643           status-context: "Tox Merge"
644           permit-all: true
645           github-hooks: true
646           org-list:
647             - "{github-org}"
648           white-list: "{obj:github_pr_whitelist}"
649           admin-list: "{obj:github_pr_admin_list}"
650           white-list-target-branches:
651             - "{branch}"
652           included-regions: "{obj:github_included_regions}"
653
654 ########
655 # PyPI #
656 ########
657
658 - lf_pypi_common: &lf_pypi_common
659     name: lf-pypi-common
660
661     ######################
662     # Default parameters #
663     ######################
664
665     branch: master
666     build-days-to-keep: 7
667     build-timeout: 15
668     disable-job: false
669     dist-binary: true
670     git-url: "$GIT_URL/$GERRIT_PROJECT"
671     github-url: "https://github.com"
672     parallel: false
673     pre-build-script: "# pre-build script goes here"
674     python-version: python3
675     stream: master
676     submodule-disable: false
677     submodule-recursive: true
678     submodule-timeout: 10
679     tox-dir: "."
680     tox-envs: ""
681
682     disabled: "{disable-job}"
683
684     gerrit_trigger_file_paths:
685       - compare-type: ANT
686         pattern: ".*"
687
688     # github_included_regions MUST match gerrit_trigger_file_paths
689     github_included_regions:
690       - ".*"
691
692     parameters:
693       - lf-infra-parameters:
694           project: "{project}"
695           branch: "{branch}"
696           stream: "{stream}"
697       - lf-infra-tox-parameters:
698           tox-dir: "{tox-dir}"
699           tox-envs: "{tox-envs}"
700       - bool:
701           name: BUILD_BDIST_WHEEL
702           default: "{dist-binary}"
703           description: "Set to True to build a wheel"
704       - bool:
705           name: DRY_RUN
706           default: false
707           description: |
708             If DRY_RUN is enabled artifacts are not published.
709
710 - lf_pypi_verify_builders: &lf_pypi_verify_builders
711     name: lf-pypi-verify-builders
712
713     builders:
714       - lf-infra-pre-build
715       - lf-infra-tox-install:
716           python-version: "{python-version}"
717       - shell: "{pre-build-script}"
718       - lf-infra-tox-run:
719           parallel: "{parallel}"
720       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
721
722 - lf_pypi_merge_builders: &lf_pypi_merge_builders
723     name: lf-pypi-merge-builders
724
725     builders:
726       - lf-infra-pre-build
727       - lf-infra-tox-install:
728           python-version: "{python-version}"
729       - shell: "{pre-build-script}"
730       - lf-infra-tox-run:
731           parallel: "{parallel}"
732       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
733       - lf-infra-pypi-upload:
734           pypi-repo: "{pypi-repo}"
735
736 - lf_pypi_release_verify_builders: &lf_pypi_release_verify_builders
737     name: lf-pypi-release-verify-builders
738
739     builders:
740       - lf-infra-pre-build
741       - lf-infra-tox-install:
742           python-version: "{python-version}"
743       - shell: "{pre-build-script}"
744       - lf-infra-tox-run:
745           parallel: "{parallel}"
746       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
747       - lf-infra-pypi-tag-release
748
749 - lf_pypi_release_merge_builders: &lf_pypi_release_merge_builders
750     name: lf-pypi-release-merge-builders
751
752     builders:
753       - lf-infra-pre-build
754       - lf-infra-tox-install:
755           python-version: "{python-version}"
756       - shell: "{pre-build-script}"
757       - lf-infra-tox-run:
758           parallel: "{parallel}"
759       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
760       - lf-infra-pypi-tag-release
761       - lf-infra-pypi-upload:
762           pypi-repo: "{pypi-repo}"
763
764 - job-template:
765     name: "{project-name}-pypi-verify-{stream}"
766     id: gerrit-pypi-verify
767     <<: *lf_python_common
768     # yamllint disable-line rule:key-duplicates
769     <<: *lf_pypi_common
770     <<: *lf_pypi_verify_builders
771
772     scm:
773       - lf-infra-gerrit-scm:
774           jenkins-ssh-credential: "{jenkins-ssh-credential}"
775           git-url: "{git-url}"
776           refspec: "$GERRIT_REFSPEC"
777           branch: "$GERRIT_BRANCH"
778           submodule-recursive: "{submodule-recursive}"
779           submodule-timeout: "{submodule-timeout}"
780           submodule-disable: "{submodule-disable}"
781           choosing-strategy: gerrit
782
783     triggers:
784       - gerrit:
785           server-name: "{gerrit-server-name}"
786           trigger-on:
787             - patchset-created-event:
788                 exclude-drafts: true
789                 exclude-trivial-rebase: false
790                 exclude-no-code-change: false
791             - draft-published-event
792             - comment-added-contains-event:
793                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
794           projects:
795             - project-compare-type: ANT
796               project-pattern: "{project}"
797               branches:
798                 - branch-compare-type: ANT
799                   branch-pattern: "**/{branch}"
800               file-paths: "{obj:gerrit_trigger_file_paths}"
801
802 - job-template:
803     name: "{project-name}-pypi-verify-{stream}"
804     id: github-pypi-verify
805     <<: *lf_python_common
806     # yamllint disable-line rule:key-duplicates
807     <<: *lf_pypi_common
808     <<: *lf_pypi_verify_builders
809
810     properties:
811       - github:
812           url: "{github-url}/{github-org}/{project}"
813
814     scm:
815       - lf-infra-github-scm:
816           url: "{git-clone-url}{github-org}/{project}"
817           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
818           branch: "$sha1"
819           submodule-recursive: "{submodule-recursive}"
820           submodule-timeout: "{submodule-timeout}"
821           submodule-disable: "{submodule-disable}"
822           choosing-strategy: default
823           jenkins-ssh-credential: "{jenkins-ssh-credential}"
824
825     triggers:
826       - github-pull-request:
827           trigger-phrase: "^(recheck|reverify)$"
828           only-trigger-phrase: false
829           status-context: "PyPI Verify"
830           permit-all: true
831           github-hooks: true
832           white-list-target-branches:
833             - "{branch}"
834           included-regions: "{obj:github_included_regions}"
835
836 - job-template:
837     name: "{project-name}-pypi-merge-{stream}"
838     id: gerrit-pypi-merge
839     <<: *lf_python_common
840     # yamllint disable-line rule:key-duplicates
841     <<: *lf_pypi_common
842     <<: *lf_pypi_merge_builders
843
844     cron: ""
845     pypi-repo: pypi-test
846
847     scm:
848       - lf-infra-gerrit-scm:
849           jenkins-ssh-credential: "{jenkins-ssh-credential}"
850           git-url: "{git-url}"
851           refspec: "$GERRIT_REFSPEC"
852           branch: "$GERRIT_BRANCH"
853           submodule-recursive: "{submodule-recursive}"
854           submodule-timeout: "{submodule-timeout}"
855           submodule-disable: "{submodule-disable}"
856           choosing-strategy: gerrit
857
858     triggers:
859       - timed: "{obj:cron}"
860       - gerrit:
861           server-name: "{gerrit-server-name}"
862           trigger-on:
863             - change-merged-event
864             - comment-added-contains-event:
865                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
866           projects:
867             - project-compare-type: ANT
868               project-pattern: "{project}"
869               branches:
870                 - branch-compare-type: ANT
871                   branch-pattern: "**/{branch}"
872               file-paths: "{obj:gerrit_trigger_file_paths}"
873
874 - job-template:
875     name: "{project-name}-pypi-merge-{stream}"
876     id: github-pypi-merge
877     <<: *lf_python_common
878     # yamllint disable-line rule:key-duplicates
879     <<: *lf_pypi_common
880     <<: *lf_pypi_merge_builders
881
882     cron: ""
883     pypi-repo: pypi-test
884
885     properties:
886       - github:
887           url: "{github-url}/{github-org}/{project}"
888
889     scm:
890       - lf-infra-github-scm:
891           url: "{git-clone-url}{github-org}/{project}"
892           refspec: ""
893           branch: "refs/heads/{branch}"
894           submodule-recursive: "{submodule-recursive}"
895           submodule-timeout: "{submodule-timeout}"
896           submodule-disable: "{submodule-disable}"
897           choosing-strategy: default
898           jenkins-ssh-credential: "{jenkins-ssh-credential}"
899
900     triggers:
901       - timed: "{obj:cron}"
902       - github-pull-request:
903           trigger-phrase: "^remerge$"
904           only-trigger-phrase: false
905           status-context: "Merge"
906           permit-all: true
907           github-hooks: true
908           org-list:
909             - "{github-org}"
910           white-list: "{obj:github_pr_whitelist}"
911           admin-list: "{obj:github_pr_admin_list}"
912           white-list-target-branches:
913             - "{branch}"
914           included-regions: "{obj:github_included_regions}"
915
916 - lf_pypi_release_common: &lf_pypi_release_common
917     name: lf-pypi-release-common
918
919     dist-binary: true
920     pypi-repo: pypi
921     use-release-file: true
922
923     # define once and use twice; jobs MUST NOT override
924     gerrit_release_trigger_file_paths:
925       - compare-type: REG_EXP
926         pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
927
928     # github_release_included_regions MUST match gerrit_release_trigger_file_paths
929     github_release_included_regions:
930       - 'releases\/.*\.yaml'
931       - '.releases\/.*\.yaml'
932
933     parameters:
934       - lf-infra-parameters:
935           project: "{project}"
936           branch: "{branch}"
937           stream: "{stream}"
938       - lf-infra-tox-parameters:
939           tox-dir: "{tox-dir}"
940           tox-envs: "{tox-envs}"
941       - bool:
942           name: BUILD_BDIST_WHEEL
943           default: "{dist-binary}"
944           description: "Set to True to build a wheel"
945       - string:
946           name: VERSION
947           default: ""
948           description: "This is the version, example: 1.0.0"
949       - bool:
950           name: USE_RELEASE_FILE
951           default: "{use-release-file}"
952           description: "Set to False for job built with parameters"
953       - bool:
954           name: DRY_RUN
955           default: false
956           description: |
957             If DRY_RUN is enabled artifacts are not published.
958
959 - job-template:
960     name: "{project-name}-pypi-release-verify-{stream}"
961     id: gerrit-pypi-release-verify
962     <<: *lf_python_common
963     # yamllint disable-line rule:key-duplicates
964     <<: *lf_pypi_common
965     <<: *lf_pypi_release_common
966     <<: *lf_pypi_release_verify_builders
967
968     scm:
969       - lf-infra-gerrit-scm:
970           jenkins-ssh-credential: "{jenkins-ssh-credential}"
971           git-url: "{git-url}"
972           refspec: "$GERRIT_REFSPEC"
973           branch: "$GERRIT_BRANCH"
974           submodule-recursive: "{submodule-recursive}"
975           submodule-timeout: "{submodule-timeout}"
976           submodule-disable: "{submodule-disable}"
977           choosing-strategy: gerrit
978
979     triggers:
980       - gerrit:
981           server-name: "{gerrit-server-name}"
982           trigger-on:
983             - patchset-created-event:
984                 exclude-drafts: true
985                 exclude-trivial-rebase: false
986                 exclude-no-code-change: false
987             - draft-published-event
988             - comment-added-contains-event:
989                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
990           projects:
991             - project-compare-type: "ANT"
992               project-pattern: "{project}"
993               branches:
994                 - branch-compare-type: ANT
995                   branch-pattern: "**/{branch}"
996               file-paths: "{obj:gerrit_release_trigger_file_paths}"
997
998 - job-template:
999     name: "{project-name}-pypi-release-verify-{stream}"
1000     id: github-pypi-release-verify
1001     <<: *lf_python_common
1002     # yamllint disable-line rule:key-duplicates
1003     <<: *lf_pypi_common
1004     <<: *lf_pypi_release_common
1005     <<: *lf_pypi_release_verify_builders
1006
1007     properties:
1008       - github:
1009           url: "{github-url}/{github-org}/{project}"
1010
1011     scm:
1012       - lf-infra-github-scm:
1013           url: "{git-clone-url}{github-org}/{project}"
1014           refspec: ""
1015           branch: "refs/heads/{branch}"
1016           submodule-recursive: "{submodule-recursive}"
1017           submodule-timeout: "{submodule-timeout}"
1018           submodule-disable: "{submodule-disable}"
1019           choosing-strategy: default
1020           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1021
1022     triggers:
1023       - github-pull-request:
1024           trigger-phrase: "^(recheck|reverify)$"
1025           only-trigger-phrase: false
1026           status-context: "PyPI Release Verify"
1027           permit-all: true
1028           github-hooks: true
1029           white-list-target-branches:
1030             - "{branch}"
1031           included-regions: "{obj:github_release_included_regions}"
1032
1033 - job-template:
1034     name: "{project-name}-pypi-release-merge-{stream}"
1035     id: gerrit-pypi-release-merge
1036     <<: *lf_python_common
1037     # yamllint disable-line rule:key-duplicates
1038     <<: *lf_pypi_common
1039     <<: *lf_pypi_release_common
1040     <<: *lf_pypi_release_merge_builders
1041
1042     scm:
1043       - lf-infra-gerrit-scm:
1044           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1045           git-url: "{git-url}"
1046           refspec: "$GERRIT_REFSPEC"
1047           branch: "$GERRIT_BRANCH"
1048           submodule-recursive: "{submodule-recursive}"
1049           submodule-timeout: "{submodule-timeout}"
1050           submodule-disable: "{submodule-disable}"
1051           choosing-strategy: gerrit
1052
1053     triggers:
1054       - gerrit:
1055           server-name: "{gerrit-server-name}"
1056           trigger-on:
1057             - change-merged-event
1058             - comment-added-contains-event:
1059                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
1060           projects:
1061             - project-compare-type: "ANT"
1062               project-pattern: "{project}"
1063               branches:
1064                 - branch-compare-type: ANT
1065                   branch-pattern: "**/{branch}"
1066               file-paths: "{obj:gerrit_release_trigger_file_paths}"
1067
1068 - job-template:
1069     name: "{project-name}-pypi-release-merge-{stream}"
1070     id: github-pypi-release-merge
1071     <<: *lf_python_common
1072     # yamllint disable-line rule:key-duplicates
1073     <<: *lf_pypi_common
1074     <<: *lf_pypi_release_common
1075     <<: *lf_pypi_release_merge_builders
1076
1077     properties:
1078       - github:
1079           url: "{github-url}/{github-org}/{project}"
1080
1081     scm:
1082       - lf-infra-github-scm:
1083           url: "{git-clone-url}{github-org}/{project}"
1084           refspec: ""
1085           branch: "refs/heads/{branch}"
1086           submodule-recursive: "{submodule-recursive}"
1087           submodule-timeout: "{submodule-timeout}"
1088           submodule-disable: "{submodule-disable}"
1089           choosing-strategy: default
1090           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1091
1092     triggers:
1093       - github-pull-request:
1094           trigger-phrase: "^(remerge)$"
1095           only-trigger-phrase: false
1096           status-context: "PyPI Release Merge"
1097           permit-all: true
1098           github-hooks: true
1099           white-list-target-branches:
1100             - "{branch}"
1101           included-regions: "{obj:github_release_included_regions}"