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