fa7a7551ba9b47a42a1eaabd5fbd923851f265b9
[releng/global-jjb.git] / jjb / lf-release-jobs.yaml
1 # SPDX-License-Identifier: Apache-2.0
2 ##############################################################################
3 # Copyright (c) 2019 The Linux Foundation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 ---
10 ####################
11 # COMMON FUNCTIONS #
12 ####################
13
14 - lf_release_common: &lf_release_common
15     name: lf-release-common
16
17     #####################
18     # Job Configuration #
19     #####################
20
21     project-type: freestyle
22     node: "{build-node}"
23
24     properties:
25       - lf-infra-properties:
26           build-days-to-keep: 7
27
28     publishers:
29       - lf-infra-publish
30
31 ##################
32 # RELEASE VERIFY #
33 ##################
34
35 - lf_release_verify: &lf_release_verify
36     name: lf-release-verify
37
38     ######################
39     # Default parameters #
40     ######################
41
42     build-days-to-keep: 7
43     build-timeout: 15
44     disable-job: false
45     git-url: "$GIT_URL/$PROJECT"
46     gerrit-skip-vote: false
47     use-release-file: true
48
49     gerrit_verify_triggers:
50       - patchset-created-event:
51           exclude-drafts: true
52           exclude-trivial-rebase: false
53           exclude-no-code-change: false
54       - draft-published-event
55       - comment-added-contains-event:
56           # yamllint disable-line rule:line-length
57           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
58
59     #####################
60     # Job Configuration #
61     #####################
62
63     disabled: "{disable-job}"
64
65     parameters:
66       - lf-infra-parameters:
67           project: "{project}"
68           branch: "$GERRIT_BRANCH"
69           stream: "$GERRIT_BRANCH"
70       - lf-build-with-parameters-maven-release:
71           use-release-file: "{use-release-file}"
72
73     builders:
74       - lf-infra-pre-build
75       - conditional-step:
76           condition-kind: regex-match
77           regex: "^.*-docker-.*"
78           label: "{build-node}"
79           steps:
80             - lf-provide-maven-settings:
81                 global-settings-file: "global-settings"
82                 settings-file: "{mvn-settings}"
83             - shell: !include-raw-escape: ../shell/docker-login.sh
84             - lf-provide-maven-settings-cleanup
85       - config-file-provider:
86           files:
87             - file-id: sigul-config
88               variable: SIGUL_CONFIG
89             - file-id: sigul-password
90               variable: SIGUL_PASSWORD
91             - file-id: sigul-pki
92               variable: SIGUL_PKI
93             - file-id: signing-pubkey
94               variable: SIGNING_PUBKEY
95       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
96       - shell: !include-raw-escape: ../shell/sigul-install.sh
97       - lf-release
98
99 - job-template:
100     name: "{project-name}-release-verify"
101     id: gerrit-release-verify
102     <<: *lf_release_common
103     # yamllint disable-line rule:key-duplicates
104     <<: *lf_release_verify
105
106     wrappers:
107       - lf-infra-wrappers:
108           build-timeout: "{build-timeout}"
109           jenkins-ssh-credential: "{jenkins-ssh-credential}"
110
111     scm:
112       - lf-infra-gerrit-scm:
113           git-url: "{git-url}"
114           refspec: "$GERRIT_REFSPEC"
115           branch: "$GERRIT_BRANCH"
116           submodule-disable: true
117           submodule-recursive: false
118           submodule-timeout: 10
119           choosing-strategy: gerrit
120           jenkins-ssh-credential: "{jenkins-ssh-credential}"
121
122     triggers:
123       - gerrit:
124           server-name: "{gerrit-server-name}"
125           trigger-on: "{obj:gerrit_verify_triggers}"
126           projects:
127             - project-compare-type: "ANT"
128               project-pattern: "{project}"
129               branches:
130                 - branch-compare-type: "ANT"
131                   branch-pattern: "**"
132               file-paths:
133                 - compare-type: REG_EXP
134                   pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
135           skip-vote:
136             successful: "{gerrit-skip-vote}"
137             failed: "{gerrit-skip-vote}"
138             unstable: "{gerrit-skip-vote}"
139             notbuilt: "{gerrit-skip-vote}"
140
141 #################
142 # RELEASE MERGE #
143 #################
144
145 - lf_release_merge: &lf_release_merge
146     name: lf-release-merge
147
148     ######################
149     # Default parameters #
150     ######################
151
152     build-days-to-keep: 7
153     build-timeout: 15
154     disable-job: false
155     git-url: "$GIT_URL/$PROJECT"
156     use-release-file: true
157
158     gerrit_merge_triggers:
159       - change-merged-event
160       - comment-added-contains-event:
161           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
162
163     #####################
164     # Job Configuration #
165     #####################
166
167     disabled: "{disable-job}"
168
169     parameters:
170       - lf-infra-parameters:
171           project: "{project}"
172           branch: "$GERRIT_BRANCH"
173           stream: "$GERRIT_BRANCH"
174       - lf-build-with-parameters-maven-release:
175           use-release-file: "{use-release-file}"
176       - bool:
177           name: DRY_RUN
178           default: false
179           description: |
180             If DRY_RUN is enabled artifacts are not published.
181
182     builders:
183       - lf-infra-pre-build
184       - conditional-step:
185           condition-kind: regex-match
186           regex: "^.*-docker-.*"
187           label: "{build-node}"
188           steps:
189             - lf-provide-maven-settings:
190                 global-settings-file: "global-settings"
191                 settings-file: "{mvn-settings}"
192             - shell: !include-raw-escape: ../shell/docker-login.sh
193             - lf-provide-maven-settings-cleanup
194       - config-file-provider:
195           files:
196             - file-id: sigul-config
197               variable: SIGUL_CONFIG
198             - file-id: sigul-password
199               variable: SIGUL_PASSWORD
200             - file-id: sigul-pki
201               variable: SIGUL_PKI
202             - file-id: signing-pubkey
203               variable: SIGNING_PUBKEY
204       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
205       - shell: !include-raw-escape: ../shell/sigul-install.sh
206       - lf-release
207
208 - job-template:
209     name: "{project-name}-release-merge"
210     id: gerrit-release-merge
211     <<: *lf_release_common
212     # yamllint disable-line rule:key-duplicates
213     <<: *lf_release_merge
214
215     wrappers:
216       - lf-infra-wrappers:
217           build-timeout: "{build-timeout}"
218           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
219
220     scm:
221       - lf-infra-gerrit-scm:
222           jenkins-ssh-credential: "{jenkins-ssh-credential}"
223           git-url: "{git-url}"
224           refspec: "$GERRIT_REFSPEC"
225           branch: "$GERRIT_BRANCH"
226           submodule-disable: true
227           submodule-recursive: false
228           submodule-timeout: 10
229           choosing-strategy: default
230
231     triggers:
232       - gerrit:
233           server-name: "{gerrit-server-name}"
234           trigger-on: "{obj:gerrit_merge_triggers}"
235           projects:
236             - project-compare-type: "ANT"
237               project-pattern: "{project}"
238               branches:
239                 - branch-compare-type: "ANT"
240                   branch-pattern: "**"
241               file-paths:
242                 - compare-type: REG_EXP
243                   pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
244
245 ################
246 # PyPI RELEASE #
247 ################
248
249 - lf_pypi_verify_wrappers: &lf_pypi_verify_wrappers
250     name: lf-pypi-verify-wrappers
251
252     wrappers:
253       - lf-infra-wrappers:
254           build-timeout: "{build-timeout}"
255           jenkins-ssh-credential: "{jenkins-ssh-credential}"
256
257 - lf_pypi_release_wrappers: &lf_pypi_release_wrappers
258     name: lf-pypi-release-wrappers
259
260     wrappers:
261       - lf-infra-wrappers:
262           build-timeout: "{build-timeout}"
263           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
264
265 - lf_pypi_release: &lf_pypi_release
266     name: lf-pypi-release
267
268     ######################
269     # Default parameters #
270     ######################
271
272     branch: master # for github
273     build-days-to-keep: 7
274     build-timeout: 15
275     disable-job: false
276     gerrit-skip-vote: false
277     git-url: "$GIT_URL/$PROJECT"
278     github-url: "https://github.com"
279     pypi-repo: pypi
280     pypi-stage-index: https://test.pypi.org/simple
281     submodule-disable: true
282     submodule-recursive: false
283     submodule-timeout: 10
284     use-release-file: true
285
286     # define once and use twice; jobs MUST NOT override
287     gerrit_release_trigger_file_paths:
288       - compare-type: REG_EXP
289         pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
290
291     # yamllint disable-line rule:line-length
292     # github_release_included_regions MUST match gerrit_release_trigger_file_paths
293     github_release_included_regions:
294       - 'releases\/.*\.yaml'
295       - '.releases\/.*\.yaml'
296
297     parameters:
298       - lf-infra-parameters:
299           project: "{project}"
300           branch: "$GERRIT_BRANCH"
301           stream: "$GERRIT_BRANCH"
302       # accept all entries defined in the release-yaml file
303       - string:
304           name: DISTRIBUTION_TYPE
305           default: "pypi"
306           description: "The Jenkins release job distribution type."
307       - string:
308           name: LOG_DIR
309           default: ""
310           description: "The partial path of logs from the PyPI merge job."
311       - string:
312           name: PYPI_PROJECT
313           default: ""
314           description: "The PyPI project name."
315       - string:
316           name: PYTHON_VERSION
317           default: ""
318           description: "The Python compatibility version, example: 3.6"
319       - string:
320           name: VERSION
321           default: ""
322           description: "The module version, example: 1.0.0"
323       # special parameters for manual use of the Jenkins job
324       - bool:
325           name: USE_RELEASE_FILE
326           default: true
327           description: "Set to False (unchecked) to build with parameters"
328       - bool:
329           name: DRY_RUN
330           default: false
331           description: "Set to True (checked) to skip uploading artifacts"
332
333     builders:
334       - lf-infra-pre-build
335       - config-file-provider:
336           files:
337             - file-id: sigul-config
338               variable: SIGUL_CONFIG
339             - file-id: sigul-password
340               variable: SIGUL_PASSWORD
341             - file-id: sigul-pki
342               variable: SIGUL_PKI
343             - file-id: signing-pubkey
344               variable: SIGNING_PUBKEY
345             - file-id: pypirc
346               target: "$HOME/.pypirc"
347       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
348       - shell: !include-raw-escape: ../shell/sigul-install.sh
349       - inject:
350           properties-content: |
351             PYPI_INDEX={pypi-stage-index}
352             REPOSITORY={pypi-repo}
353       - shell: !include-raw-escape: ../shell/release-job.sh
354
355 - job-template:
356     name: "{project-name}-pypi-release-merge"
357     id: gerrit-pypi-release-merge
358     <<: *lf_release_common
359     <<: *lf_pypi_release_wrappers
360     <<: *lf_pypi_release
361
362     scm:
363       - lf-infra-gerrit-scm:
364           jenkins-ssh-credential: "{jenkins-ssh-credential}"
365           git-url: "{git-url}"
366           refspec: "$GERRIT_REFSPEC"
367           branch: "$GERRIT_BRANCH"
368           submodule-recursive: "{submodule-recursive}"
369           submodule-timeout: "{submodule-timeout}"
370           submodule-disable: "{submodule-disable}"
371           choosing-strategy: gerrit
372
373     triggers:
374       - gerrit:
375           server-name: "{gerrit-server-name}"
376           trigger-on:
377             - change-merged-event
378             - comment-added-contains-event:
379                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
380           projects:
381             - project-compare-type: "ANT"
382               project-pattern: "{project}"
383               branches:
384                 - branch-compare-type: ANT
385                   branch-pattern: "**"
386               file-paths: "{obj:gerrit_release_trigger_file_paths}"
387
388 - job-template:
389     name: "{project-name}-pypi-release-merge"
390     id: github-pypi-release-merge
391     <<: *lf_release_common
392     <<: *lf_pypi_release_wrappers
393     <<: *lf_pypi_release
394
395     properties:
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: ""
403           branch: "refs/heads/{branch}"
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: "^(remerge)$"
413           only-trigger-phrase: false
414           status-context: "PyPI Release Merge"
415           permit-all: true
416           github-hooks: true
417           white-list-target-branches:
418             - "{branch}"
419           included-regions: "{obj:github_release_included_regions}"
420
421 - job-template:
422     name: "{project-name}-pypi-release-verify"
423     id: gerrit-pypi-release-verify
424     <<: *lf_release_common
425     <<: *lf_pypi_verify_wrappers
426     <<: *lf_pypi_release
427
428     scm:
429       - lf-infra-gerrit-scm:
430           jenkins-ssh-credential: "{jenkins-ssh-credential}"
431           git-url: "{git-url}"
432           refspec: "$GERRIT_REFSPEC"
433           branch: "$GERRIT_BRANCH"
434           submodule-recursive: "{submodule-recursive}"
435           submodule-timeout: "{submodule-timeout}"
436           submodule-disable: "{submodule-disable}"
437           choosing-strategy: gerrit
438
439     triggers:
440       - gerrit:
441           server-name: "{gerrit-server-name}"
442           trigger-on:
443             - patchset-created-event:
444                 exclude-drafts: true
445                 exclude-trivial-rebase: false
446                 exclude-no-code-change: false
447             - draft-published-event
448             - comment-added-contains-event:
449                 # yamllint disable-line rule:line-length
450                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
451           projects:
452             - project-compare-type: "ANT"
453               project-pattern: "{project}"
454               branches:
455                 - branch-compare-type: ANT
456                   branch-pattern: "**"
457               file-paths: "{obj:gerrit_release_trigger_file_paths}"
458
459 - job-template:
460     name: "{project-name}-pypi-release-verify"
461     id: github-pypi-release-verify
462     <<: *lf_release_common
463     <<: *lf_pypi_verify_wrappers
464     <<: *lf_pypi_release
465
466     properties:
467       - github:
468           url: "{github-url}/{github-org}/{project}"
469
470     scm:
471       - lf-infra-github-scm:
472           url: "{git-clone-url}{github-org}/{project}"
473           refspec: ""
474           branch: "refs/heads/{branch}"
475           submodule-recursive: "{submodule-recursive}"
476           submodule-timeout: "{submodule-timeout}"
477           submodule-disable: "{submodule-disable}"
478           choosing-strategy: default
479           jenkins-ssh-credential: "{jenkins-ssh-credential}"
480
481     triggers:
482       - github-pull-request:
483           trigger-phrase: "^(recheck|reverify)$"
484           only-trigger-phrase: false
485           status-context: "PyPI Release Verify"
486           permit-all: true
487           github-hooks: true
488           white-list-target-branches:
489             - "{branch}"
490           included-regions: "{obj:github_release_included_regions}"
491
492 ###############################
493 # PackageCloud RELEASE VERIFY #
494 ###############################
495
496 - lf_packagecloud_verify: &lf_packagecloud_verify
497     name: lf-packagecloud-verify
498
499     ######################
500     # Default parameters #
501     ######################
502
503     build-days-to-keep: 7
504     build-timeout: 15
505     disable-job: false
506     git-url: "$GIT_URL/$PROJECT"
507     gerrit-skip-vote: false
508     use-release-file: true
509
510     gerrit_verify_triggers:
511       - patchset-created-event:
512           exclude-drafts: true
513           exclude-trivial-rebase: false
514           exclude-no-code-change: false
515       - draft-published-event
516       - comment-added-contains-event:
517           # yamllint disable-line rule:line-length
518           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
519
520     #####################
521     # Job Configuration #
522     #####################
523
524     disabled: "{disable-job}"
525
526     parameters:
527       - lf-infra-parameters:
528           project: "{project}"
529           branch: "$GERRIT_BRANCH"
530           stream: "$GERRIT_BRANCH"
531       - lf-build-with-parameters-maven-release:
532           use-release-file: "{use-release-file}"
533
534     builders:
535       - lf-infra-pre-build
536       - config-file-provider:
537           files:
538             - file-id: "packagecloud_api"
539               target: "$HOME/packagecloud_api"
540       - lf-release
541
542 - job-template:
543     name: "{project-name}-packagecloud-verify"
544     id: gerrit-packagecloud-verify
545     <<: *lf_release_common
546     # yamllint disable-line rule:key-duplicates
547     <<: *lf_packagecloud_verify
548
549     wrappers:
550       - lf-infra-wrappers:
551           build-timeout: "{build-timeout}"
552           jenkins-ssh-credential: "{jenkins-ssh-credential}"
553
554     scm:
555       - lf-infra-gerrit-scm:
556           git-url: "{git-url}"
557           refspec: "$GERRIT_REFSPEC"
558           branch: "$GERRIT_BRANCH"
559           submodule-disable: true
560           submodule-recursive: false
561           submodule-timeout: 10
562           choosing-strategy: gerrit
563           jenkins-ssh-credential: "{jenkins-ssh-credential}"
564
565     triggers:
566       - gerrit:
567           server-name: "{gerrit-server-name}"
568           trigger-on: "{obj:gerrit_verify_triggers}"
569           projects:
570             - project-compare-type: "ANT"
571               project-pattern: "{project}"
572               branches:
573                 - branch-compare-type: "ANT"
574                   branch-pattern: "**"
575               file-paths:
576                 - compare-type: REG_EXP
577                   pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
578           skip-vote:
579             successful: "{gerrit-skip-vote}"
580             failed: "{gerrit-skip-vote}"
581             unstable: "{gerrit-skip-vote}"
582             notbuilt: "{gerrit-skip-vote}"
583
584 ##############################
585 # PackageCloud RELEASE MERGE #
586 ##############################
587
588 - lf_packagecloud_merge: &lf_packagecloud_merge
589     name: lf-packagecloud-merge
590
591     ######################
592     # Default parameters #
593     ######################
594
595     build-days-to-keep: 7
596     build-timeout: 15
597     disable-job: false
598     git-url: "$GIT_URL/$PROJECT"
599     use-release-file: true
600
601     gerrit_merge_triggers:
602       - change-merged-event
603       - comment-added-contains-event:
604           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
605
606     #####################
607     # Job Configuration #
608     #####################
609
610     disabled: "{disable-job}"
611
612     parameters:
613       - lf-infra-parameters:
614           project: "{project}"
615           branch: "$GERRIT_BRANCH"
616           stream: "$GERRIT_BRANCH"
617       - lf-build-with-parameters-maven-release:
618           use-release-file: "{use-release-file}"
619       - bool:
620           name: DRY_RUN
621           default: false
622           description: |
623             If DRY_RUN is enabled artifacts are not published.
624
625     builders:
626       - lf-infra-pre-build
627       - config-file-provider:
628           files:
629             - file-id: "packagecloud_api"
630               target: "$HOME/packagecloud_api"
631       - lf-release
632
633 - job-template:
634     name: "{project-name}-packagecloud-merge"
635     id: gerrit-packagecloud-merge
636     <<: *lf_release_common
637     # yamllint disable-line rule:key-duplicates
638     <<: *lf_packagecloud_merge
639
640     wrappers:
641       - lf-infra-wrappers:
642           build-timeout: "{build-timeout}"
643           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
644
645     scm:
646       - lf-infra-gerrit-scm:
647           jenkins-ssh-credential: "{jenkins-ssh-credential}"
648           git-url: "{git-url}"
649           refspec: "$GERRIT_REFSPEC"
650           branch: "$GERRIT_BRANCH"
651           submodule-disable: true
652           submodule-recursive: false
653           submodule-timeout: 10
654           choosing-strategy: default
655
656     triggers:
657       - gerrit:
658           server-name: "{gerrit-server-name}"
659           trigger-on: "{obj:gerrit_merge_triggers}"
660           projects:
661             - project-compare-type: "ANT"
662               project-pattern: "{project}"
663               branches:
664                 - branch-compare-type: "ANT"
665                   branch-pattern: "**"
666               file-paths:
667                 - compare-type: REG_EXP
668                   pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'