Extend tag feature of release jobs
[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\/pypi.*\.yaml|\.releases\/pypi.*\.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\/pypi.*\.yaml'
295       - '.releases\/pypi.*\.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: GIT_TAG
313           default: ""
314           description: "Tag to push to git repo; optional, defaults to VERSION."
315       - string:
316           name: PYPI_PROJECT
317           default: ""
318           description: "The PyPI project name."
319       - string:
320           name: PYTHON_VERSION
321           default: ""
322           description: "The Python compatibility version, example: 3.6"
323       - string:
324           name: VERSION
325           default: ""
326           description: "The module version, example: 1.0.0"
327       # special parameters for manual use of the Jenkins job
328       - bool:
329           name: USE_RELEASE_FILE
330           default: true
331           description: "Set to False (unchecked) to build with parameters"
332       - bool:
333           name: DRY_RUN
334           default: false
335           description: "Set to True (checked) to skip uploading artifacts"
336
337     builders:
338       - lf-infra-pre-build
339       - config-file-provider:
340           files:
341             - file-id: sigul-config
342               variable: SIGUL_CONFIG
343             - file-id: sigul-password
344               variable: SIGUL_PASSWORD
345             - file-id: sigul-pki
346               variable: SIGUL_PKI
347             - file-id: signing-pubkey
348               variable: SIGNING_PUBKEY
349             - file-id: pypirc
350               target: "$HOME/.pypirc"
351       - shell: !include-raw-escape: ../shell/sigul-configuration.sh
352       - shell: !include-raw-escape: ../shell/sigul-install.sh
353       - inject:
354           properties-content: |
355             PYPI_INDEX={pypi-stage-index}
356             REPOSITORY={pypi-repo}
357       - shell: !include-raw-escape: ../shell/release-job.sh
358
359 - job-template:
360     name: "{project-name}-pypi-release-merge"
361     id: gerrit-pypi-release-merge
362     <<: *lf_release_common
363     <<: *lf_pypi_release_wrappers
364     <<: *lf_pypi_release
365
366     scm:
367       - lf-infra-gerrit-scm:
368           jenkins-ssh-credential: "{jenkins-ssh-credential}"
369           git-url: "{git-url}"
370           refspec: "$GERRIT_REFSPEC"
371           branch: "$GERRIT_BRANCH"
372           submodule-recursive: "{submodule-recursive}"
373           submodule-timeout: "{submodule-timeout}"
374           submodule-disable: "{submodule-disable}"
375           choosing-strategy: gerrit
376
377     triggers:
378       - gerrit:
379           server-name: "{gerrit-server-name}"
380           trigger-on:
381             - change-merged-event
382             - comment-added-contains-event:
383                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
384           projects:
385             - project-compare-type: "ANT"
386               project-pattern: "{project}"
387               branches:
388                 - branch-compare-type: ANT
389                   branch-pattern: "**"
390               file-paths: "{obj:gerrit_release_trigger_file_paths}"
391
392 - job-template:
393     name: "{project-name}-pypi-release-merge"
394     id: github-pypi-release-merge
395     <<: *lf_release_common
396     <<: *lf_pypi_release_wrappers
397     <<: *lf_pypi_release
398
399     properties:
400       - github:
401           url: "{github-url}/{github-org}/{project}"
402
403     scm:
404       - lf-infra-github-scm:
405           url: "{git-clone-url}{github-org}/{project}"
406           refspec: ""
407           branch: "refs/heads/{branch}"
408           submodule-recursive: "{submodule-recursive}"
409           submodule-timeout: "{submodule-timeout}"
410           submodule-disable: "{submodule-disable}"
411           choosing-strategy: default
412           jenkins-ssh-credential: "{jenkins-ssh-credential}"
413
414     triggers:
415       - github-pull-request:
416           trigger-phrase: "^(remerge)$"
417           only-trigger-phrase: false
418           status-context: "PyPI Release Merge"
419           permit-all: true
420           github-hooks: true
421           white-list-target-branches:
422             - "{branch}"
423           included-regions: "{obj:github_release_included_regions}"
424
425 - job-template:
426     name: "{project-name}-pypi-release-verify"
427     id: gerrit-pypi-release-verify
428     <<: *lf_release_common
429     <<: *lf_pypi_verify_wrappers
430     <<: *lf_pypi_release
431
432     scm:
433       - lf-infra-gerrit-scm:
434           jenkins-ssh-credential: "{jenkins-ssh-credential}"
435           git-url: "{git-url}"
436           refspec: "$GERRIT_REFSPEC"
437           branch: "$GERRIT_BRANCH"
438           submodule-recursive: "{submodule-recursive}"
439           submodule-timeout: "{submodule-timeout}"
440           submodule-disable: "{submodule-disable}"
441           choosing-strategy: gerrit
442
443     triggers:
444       - gerrit:
445           server-name: "{gerrit-server-name}"
446           trigger-on:
447             - patchset-created-event:
448                 exclude-drafts: true
449                 exclude-trivial-rebase: false
450                 exclude-no-code-change: false
451             - draft-published-event
452             - comment-added-contains-event:
453                 # yamllint disable-line rule:line-length
454                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
455           projects:
456             - project-compare-type: "ANT"
457               project-pattern: "{project}"
458               branches:
459                 - branch-compare-type: ANT
460                   branch-pattern: "**"
461               file-paths: "{obj:gerrit_release_trigger_file_paths}"
462
463 - job-template:
464     name: "{project-name}-pypi-release-verify"
465     id: github-pypi-release-verify
466     <<: *lf_release_common
467     <<: *lf_pypi_verify_wrappers
468     <<: *lf_pypi_release
469
470     properties:
471       - github:
472           url: "{github-url}/{github-org}/{project}"
473
474     scm:
475       - lf-infra-github-scm:
476           url: "{git-clone-url}{github-org}/{project}"
477           refspec: ""
478           branch: "refs/heads/{branch}"
479           submodule-recursive: "{submodule-recursive}"
480           submodule-timeout: "{submodule-timeout}"
481           submodule-disable: "{submodule-disable}"
482           choosing-strategy: default
483           jenkins-ssh-credential: "{jenkins-ssh-credential}"
484
485     triggers:
486       - github-pull-request:
487           trigger-phrase: "^(recheck|reverify)$"
488           only-trigger-phrase: false
489           status-context: "PyPI Release Verify"
490           permit-all: true
491           github-hooks: true
492           white-list-target-branches:
493             - "{branch}"
494           included-regions: "{obj:github_release_included_regions}"
495
496 ########################
497 # PackageCloud RELEASE #
498 ########################
499
500 - lf_packagecloud_release_common: &lf_packagecloud_release_common
501     name: lf-packagecloud-release-common
502
503     ######################
504     # Default parameters #
505     ######################
506
507     build-days-to-keep: 7
508     build-timeout: 15
509     disable-job: false
510     git-url: "$GIT_URL/$PROJECT"
511     gerrit-skip-vote: false
512     use-release-file: true
513     account-name: "{account-name}"
514     source-repo: "{source-repo}"
515
516     #####################
517     # Job Configuration #
518     #####################
519
520     disabled: "{disable-job}"
521
522     parameters:
523       - lf-infra-parameters:
524           project: "{project}"
525           branch: "$GERRIT_BRANCH"
526           stream: "$GERRIT_BRANCH"
527       - string:
528           name: DISTRIBUTION_TYPE
529           default: "packagecloud"
530           description: "The Jenkins release job distribution type."
531       - bool:
532           name: DRY_RUN
533           default: false
534           description: |
535             If DRY_RUN is enabled artifacts are not promoted.
536       - bool:
537           name: USE_RELEASE_FILE
538           default: "{use-release-file}"
539           description: "Set to False for job built with parameters"
540
541     builders:
542       - lf-infra-pre-build
543       - config-file-provider:
544           files:
545             - file-id: "packagecloud_api"
546               target: "$HOME/packagecloud_api"
547             - file-id: packagecloud-account
548               variable: ACCOUNT_NAME_FILE
549       - lf-release
550
551 - job-template:
552     name: "{project-name}-packagecloud-release-verify"
553     id: gerrit-packagecloud-release-verify
554     <<: *lf_release_common
555     <<: *lf_packagecloud_release_common
556
557     wrappers:
558       - lf-infra-wrappers:
559           build-timeout: "{build-timeout}"
560           jenkins-ssh-credential: "{jenkins-ssh-credential}"
561
562     scm:
563       - lf-infra-gerrit-scm:
564           git-url: "{git-url}"
565           refspec: "$GERRIT_REFSPEC"
566           branch: "$GERRIT_BRANCH"
567           submodule-disable: true
568           submodule-recursive: false
569           submodule-timeout: 10
570           choosing-strategy: gerrit
571           jenkins-ssh-credential: "{jenkins-ssh-credential}"
572
573     triggers:
574       - gerrit:
575           server-name: "{gerrit-server-name}"
576           trigger-on:
577             - patchset-created-event:
578                 exclude-drafts: true
579                 exclude-trivial-rebase: false
580                 exclude-no-code-change: false
581             - draft-published-event
582             - comment-added-contains-event:
583                 # yamllint disable-line rule:line-length
584                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
585           projects:
586             - project-compare-type: "ANT"
587               project-pattern: "{project}"
588               branches:
589                 - branch-compare-type: "ANT"
590                   branch-pattern: "**"
591               file-paths:
592                 - compare-type: REG_EXP
593                   pattern: '(releases\/packagecloud.*\.yaml|\.releases\/packagecloud.*\.yaml)'
594           skip-vote:
595             successful: "{gerrit-skip-vote}"
596             failed: "{gerrit-skip-vote}"
597             unstable: "{gerrit-skip-vote}"
598             notbuilt: "{gerrit-skip-vote}"
599
600 - job-template:
601     name: "{project-name}-packagecloud-release-merge"
602     id: gerrit-packagecloud-release-merge
603     <<: *lf_release_common
604     <<: *lf_packagecloud_release_common
605
606     wrappers:
607       - lf-infra-wrappers:
608           build-timeout: "{build-timeout}"
609           jenkins-ssh-credential: "{jenkins-ssh-release-credential}"
610
611     scm:
612       - lf-infra-gerrit-scm:
613           jenkins-ssh-credential: "{jenkins-ssh-credential}"
614           git-url: "{git-url}"
615           refspec: "$GERRIT_REFSPEC"
616           branch: "$GERRIT_BRANCH"
617           submodule-disable: true
618           submodule-recursive: false
619           submodule-timeout: 10
620           choosing-strategy: default
621
622     triggers:
623       - gerrit:
624           server-name: "{gerrit-server-name}"
625           trigger-on:
626             - change-merged-event
627             - comment-added-contains-event:
628                 comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
629           projects:
630             - project-compare-type: "ANT"
631               project-pattern: "{project}"
632               branches:
633                 - branch-compare-type: "ANT"
634                   branch-pattern: "**"
635               file-paths:
636                 - compare-type: REG_EXP
637                   pattern: '(releases\/packagecloud.*\.yaml|\.releases\/packagecloud.*\.yaml)'