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