Merge "Add pipeline-verify jobs to lint and check agents"
[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: TAG_RELEASE
178           default: true
179           description: |
180             Tag Gerrit repo after release.
181       - bool:
182           name: DRY_RUN
183           default: false
184           description: |
185             If DRY_RUN is enabled artifacts are not published.
186
187     builders:
188       - lf-infra-pre-build
189       - conditional-step:
190           condition-kind: regex-match
191           regex: "^.*-docker-.*"
192           label: "{build-node}"
193           steps:
194             - lf-provide-maven-settings:
195                 global-settings-file: "global-settings"
196                 settings-file: "{mvn-settings}"
197             - shell: !include-raw-escape: ../shell/docker-login.sh
198             - lf-provide-maven-settings-cleanup
199       - config-file-provider:
200           files:
201             - file-id: sigul-config
202               variable: SIGUL_CONFIG
203             - file-id: sigul-password
204               variable: SIGUL_PASSWORD
205             - file-id: sigul-pki
206               variable: SIGUL_PKI
207             - file-id: signing-pubkey
208               variable: SIGNING_PUBKEY
209       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
210       - shell: !include-raw-escape: ../shell/sigul-install.sh
211       - lf-release
212
213 - job-template:
214     name: "{project-name}-release-merge"
215     id: gerrit-release-merge
216     <<: *lf_release_common
217     # yamllint disable-line rule:key-duplicates
218     <<: *lf_release_merge
219
220     wrappers:
221       - lf-infra-wrappers:
222           build-timeout: "{build-timeout}"
223           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
224
225     scm:
226       - lf-infra-gerrit-scm:
227           jenkins-ssh-credential: "{jenkins-ssh-credential}"
228           git-url: "{git-url}"
229           refspec: "$GERRIT_REFSPEC"
230           branch: "$GERRIT_BRANCH"
231           submodule-disable: true
232           submodule-recursive: false
233           submodule-timeout: 10
234           # release merge jobs build from commit not tip
235           choosing-strategy: gerrit
236
237     triggers:
238       - gerrit:
239           server-name: "{gerrit-server-name}"
240           trigger-on: "{obj:gerrit_merge_triggers}"
241           projects:
242             - project-compare-type: "ANT"
243               project-pattern: "{project}"
244               branches:
245                 - branch-compare-type: "ANT"
246                   branch-pattern: "**"
247               file-paths:
248                 - compare-type: REG_EXP
249                   pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)'
250
251 ################
252 # PyPI RELEASE #
253 ################
254
255 - lf_pypi_verify_wrappers: &lf_pypi_verify_wrappers
256     name: lf-pypi-verify-wrappers
257
258     wrappers:
259       - lf-infra-wrappers:
260           build-timeout: "{build-timeout}"
261           jenkins-ssh-credential: "{jenkins-ssh-credential}"
262
263 - lf_pypi_release_wrappers: &lf_pypi_release_wrappers
264     name: lf-pypi-release-wrappers
265
266     wrappers:
267       - lf-infra-wrappers:
268           build-timeout: "{build-timeout}"
269           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
270
271 - lf_pypi_release: &lf_pypi_release
272     name: lf-pypi-release
273
274     ######################
275     # Default parameters #
276     ######################
277
278     branch: master # for github
279     build-days-to-keep: 7
280     build-timeout: 15
281     disable-job: false
282     gerrit-skip-vote: false
283     git-url: "$GIT_URL/$PROJECT"
284     github-url: "https://github.com"
285     pypi-repo: pypi
286     pypi-stage-index: https://test.pypi.org/simple
287     submodule-disable: true
288     submodule-recursive: false
289     submodule-timeout: 10
290     use-release-file: true
291
292     # define once and use twice; jobs MUST NOT override
293     gerrit_release_trigger_file_paths:
294       - compare-type: REG_EXP
295         pattern: '(releases\/pypi.*\.yaml|\.releases\/pypi.*\.yaml)'
296
297     # yamllint disable-line rule:line-length
298     # github_release_included_regions MUST match gerrit_release_trigger_file_paths
299     github_release_included_regions:
300       - 'releases\/pypi.*\.yaml'
301       - '.releases\/pypi.*\.yaml'
302
303     parameters:
304       - lf-infra-parameters:
305           project: "{project}"
306           branch: "$GERRIT_BRANCH"
307           stream: "$GERRIT_BRANCH"
308       # accept all entries defined in the release-yaml file
309       - string:
310           name: DISTRIBUTION_TYPE
311           default: "pypi"
312           description: "The Jenkins release job distribution type."
313       - string:
314           name: LOG_DIR
315           default: ""
316           description: "The partial path of logs from the PyPI merge job."
317       - string:
318           name: GIT_TAG
319           default: ""
320           description: "Tag to push to git repo; optional, defaults to VERSION."
321       - string:
322           name: PYPI_PROJECT
323           default: ""
324           description: "The PyPI project name."
325       - string:
326           name: PYTHON_VERSION
327           default: ""
328           description: "The Python compatibility version, example: 3.6"
329       - string:
330           name: VERSION
331           default: ""
332           description: "The module version, example: 1.0.0"
333       # special parameters for manual use of the Jenkins job
334       - bool:
335           name: USE_RELEASE_FILE
336           default: true
337           description: "Set to False (unchecked) to build with parameters"
338       - bool:
339           name: TAG_RELEASE
340           default: true
341           description: |
342             Tag Gerrit repo after release.
343       - bool:
344           name: DRY_RUN
345           default: false
346           description: "Set to True (checked) to skip uploading artifacts"
347
348     builders:
349       - lf-infra-pre-build
350       - config-file-provider:
351           files:
352             - file-id: sigul-config
353               variable: SIGUL_CONFIG
354             - file-id: sigul-password
355               variable: SIGUL_PASSWORD
356             - file-id: sigul-pki
357               variable: SIGUL_PKI
358             - file-id: signing-pubkey
359               variable: SIGNING_PUBKEY
360             - file-id: pypirc
361               target: "$HOME/.pypirc"
362       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
363       - shell: !include-raw-escape: ../shell/sigul-install.sh
364       - inject:
365           properties-content: |
366             PYPI_INDEX={pypi-stage-index}
367             REPOSITORY={pypi-repo}
368       - shell: !include-raw-escape: ../shell/release-job.sh
369
370 - job-template:
371     name: "{project-name}-pypi-release-merge"
372     id: gerrit-pypi-release-merge
373     <<: *lf_release_common
374     <<: *lf_pypi_release_wrappers
375     <<: *lf_pypi_release
376
377     scm:
378       - lf-infra-gerrit-scm:
379           jenkins-ssh-credential: "{jenkins-ssh-credential}"
380           git-url: "{git-url}"
381           refspec: "$GERRIT_REFSPEC"
382           branch: "$GERRIT_BRANCH"
383           submodule-recursive: "{submodule-recursive}"
384           submodule-timeout: "{submodule-timeout}"
385           submodule-disable: "{submodule-disable}"
386           # release merge jobs build from commit not tip
387           choosing-strategy: gerrit
388
389     triggers:
390       - gerrit:
391           server-name: "{gerrit-server-name}"
392           trigger-on:
393             - change-merged-event
394             - comment-added-contains-event:
395                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
396           projects:
397             - project-compare-type: "ANT"
398               project-pattern: "{project}"
399               branches:
400                 - branch-compare-type: ANT
401                   branch-pattern: "**"
402               file-paths: "{obj:gerrit_release_trigger_file_paths}"
403
404 - job-template:
405     name: "{project-name}-pypi-release-merge"
406     id: github-pypi-release-merge
407     <<: *lf_release_common
408     <<: *lf_pypi_release_wrappers
409     <<: *lf_pypi_release
410
411     properties:
412       - github:
413           url: "{github-url}/{github-org}/{project}"
414
415     scm:
416       - lf-infra-github-scm:
417           url: "{git-clone-url}{github-org}/{project}"
418           refspec: ""
419           branch: "refs/heads/{branch}"
420           submodule-recursive: "{submodule-recursive}"
421           submodule-timeout: "{submodule-timeout}"
422           submodule-disable: "{submodule-disable}"
423           choosing-strategy: default
424           jenkins-ssh-credential: "{jenkins-ssh-credential}"
425
426     triggers:
427       - github-pull-request:
428           trigger-phrase: "^(remerge)$"
429           only-trigger-phrase: false
430           status-context: "PyPI Release Merge"
431           permit-all: true
432           github-hooks: true
433           white-list-target-branches:
434             - "{branch}"
435           included-regions: "{obj:github_release_included_regions}"
436
437 - job-template:
438     name: "{project-name}-pypi-release-verify"
439     id: gerrit-pypi-release-verify
440     <<: *lf_release_common
441     <<: *lf_pypi_verify_wrappers
442     <<: *lf_pypi_release
443
444     scm:
445       - lf-infra-gerrit-scm:
446           jenkins-ssh-credential: "{jenkins-ssh-credential}"
447           git-url: "{git-url}"
448           refspec: "$GERRIT_REFSPEC"
449           branch: "$GERRIT_BRANCH"
450           submodule-recursive: "{submodule-recursive}"
451           submodule-timeout: "{submodule-timeout}"
452           submodule-disable: "{submodule-disable}"
453           choosing-strategy: gerrit
454
455     triggers:
456       - gerrit:
457           server-name: "{gerrit-server-name}"
458           trigger-on:
459             - patchset-created-event:
460                 exclude-drafts: true
461                 exclude-trivial-rebase: false
462                 exclude-no-code-change: false
463             - draft-published-event
464             - comment-added-contains-event:
465                 # yamllint disable-line rule:line-length
466                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
467           projects:
468             - project-compare-type: "ANT"
469               project-pattern: "{project}"
470               branches:
471                 - branch-compare-type: ANT
472                   branch-pattern: "**"
473               file-paths: "{obj:gerrit_release_trigger_file_paths}"
474
475 - job-template:
476     name: "{project-name}-pypi-release-verify"
477     id: github-pypi-release-verify
478     <<: *lf_release_common
479     <<: *lf_pypi_verify_wrappers
480     <<: *lf_pypi_release
481
482     properties:
483       - github:
484           url: "{github-url}/{github-org}/{project}"
485
486     scm:
487       - lf-infra-github-scm:
488           url: "{git-clone-url}{github-org}/{project}"
489           refspec: ""
490           branch: "refs/heads/{branch}"
491           submodule-recursive: "{submodule-recursive}"
492           submodule-timeout: "{submodule-timeout}"
493           submodule-disable: "{submodule-disable}"
494           choosing-strategy: default
495           jenkins-ssh-credential: "{jenkins-ssh-credential}"
496
497     triggers:
498       - github-pull-request:
499           trigger-phrase: "^(recheck|reverify)$"
500           only-trigger-phrase: false
501           status-context: "PyPI Release Verify"
502           permit-all: true
503           github-hooks: true
504           white-list-target-branches:
505             - "{branch}"
506           included-regions: "{obj:github_release_included_regions}"
507
508 ########################
509 # PackageCloud RELEASE #
510 ########################
511
512 - lf_packagecloud_release_common: &lf_packagecloud_release_common
513     name: lf-packagecloud-release-common
514
515     ######################
516     # Default parameters #
517     ######################
518
519     build-days-to-keep: 7
520     build-timeout: 15
521     disable-job: false
522     git-url: "$GIT_URL/$PROJECT"
523     gerrit-skip-vote: false
524     use-release-file: true
525     account-name: "{account-name}"
526     source-repo: "{source-repo}"
527
528     #####################
529     # Job Configuration #
530     #####################
531
532     disabled: "{disable-job}"
533
534     parameters:
535       - lf-infra-parameters:
536           project: "{project}"
537           branch: "$GERRIT_BRANCH"
538           stream: "$GERRIT_BRANCH"
539       - string:
540           name: DISTRIBUTION_TYPE
541           default: "packagecloud"
542           description: "The Jenkins release job distribution type."
543       - bool:
544           name: TAG_RELEASE
545           default: true
546           description: |
547             Tag Gerrit repo after release.
548       - bool:
549           name: DRY_RUN
550           default: false
551           description: |
552             If DRY_RUN is enabled artifacts are not promoted.
553       - bool:
554           name: USE_RELEASE_FILE
555           default: "{use-release-file}"
556           description: "Set to False for job built with parameters"
557
558     builders:
559       - lf-infra-pre-build
560       - config-file-provider:
561           files:
562             - file-id: sigul-config
563               variable: SIGUL_CONFIG
564             - file-id: sigul-password
565               variable: SIGUL_PASSWORD
566             - file-id: sigul-pki
567               variable: SIGUL_PKI
568             - file-id: signing-pubkey
569               variable: SIGNING_PUBKEY
570             - file-id: "packagecloud_api"
571               target: "$HOME/packagecloud_api"
572             - file-id: packagecloud-account
573               variable: ACCOUNT_NAME_FILE
574       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
575       - shell: !include-raw-escape: ../shell/sigul-install.sh
576       - lf-release
577
578 - job-template:
579     name: "{project-name}-packagecloud-release-verify"
580     id: gerrit-packagecloud-release-verify
581     <<: *lf_release_common
582     <<: *lf_packagecloud_release_common
583
584     wrappers:
585       - lf-infra-wrappers:
586           build-timeout: "{build-timeout}"
587           jenkins-ssh-credential: "{jenkins-ssh-credential}"
588
589     scm:
590       - lf-infra-gerrit-scm:
591           git-url: "{git-url}"
592           refspec: "$GERRIT_REFSPEC"
593           branch: "$GERRIT_BRANCH"
594           submodule-disable: true
595           submodule-recursive: false
596           submodule-timeout: 10
597           choosing-strategy: gerrit
598           jenkins-ssh-credential: "{jenkins-ssh-credential}"
599
600     triggers:
601       - gerrit:
602           server-name: "{gerrit-server-name}"
603           trigger-on:
604             - patchset-created-event:
605                 exclude-drafts: true
606                 exclude-trivial-rebase: false
607                 exclude-no-code-change: false
608             - draft-published-event
609             - comment-added-contains-event:
610                 # yamllint disable-line rule:line-length
611                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
612           projects:
613             - project-compare-type: "ANT"
614               project-pattern: "{project}"
615               branches:
616                 - branch-compare-type: "ANT"
617                   branch-pattern: "**"
618               file-paths:
619                 - compare-type: REG_EXP
620                   pattern: '(releases\/packagecloud.*\.yaml|\.releases\/packagecloud.*\.yaml)'
621           skip-vote:
622             successful: "{gerrit-skip-vote}"
623             failed: "{gerrit-skip-vote}"
624             unstable: "{gerrit-skip-vote}"
625             notbuilt: "{gerrit-skip-vote}"
626
627 - job-template:
628     name: "{project-name}-packagecloud-release-merge"
629     id: gerrit-packagecloud-release-merge
630     <<: *lf_release_common
631     <<: *lf_packagecloud_release_common
632
633     wrappers:
634       - lf-infra-wrappers:
635           build-timeout: "{build-timeout}"
636           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
637
638     scm:
639       - lf-infra-gerrit-scm:
640           jenkins-ssh-credential: "{jenkins-ssh-credential}"
641           git-url: "{git-url}"
642           refspec: "$GERRIT_REFSPEC"
643           branch: "$GERRIT_BRANCH"
644           submodule-disable: true
645           submodule-recursive: false
646           submodule-timeout: 10
647           # release merge jobs build from commit not tip
648           choosing-strategy: gerrit
649
650     triggers:
651       - gerrit:
652           server-name: "{gerrit-server-name}"
653           trigger-on:
654             - change-merged-event
655             - comment-added-contains-event:
656                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
657           projects:
658             - project-compare-type: "ANT"
659               project-pattern: "{project}"
660               branches:
661                 - branch-compare-type: "ANT"
662                   branch-pattern: "**"
663               file-paths:
664                 - compare-type: REG_EXP
665                   pattern: '(releases\/packagecloud.*\.yaml|\.releases\/packagecloud.*\.yaml)'