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