0c9bbee5877491b364373770cbdfe533117a7c0d
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
1 ---
2 - job-group:
3     name: '{project-name}-ci-jobs'
4
5     # This job group contains all the recommended jobs that should be deployed
6     # for any project ci.
7
8     jjb-version: 1.6.2
9
10     jobs:
11       - gerrit-jjb-merge
12       - gerrit-jjb-verify
13
14 - job-group:
15     name: '{project-name}-github-ci-jobs'
16
17     # This job group contains all the recommended jobs that should be deployed
18     # for any project ci that is using github.
19
20     jjb-version: 1.6.2
21
22     jobs:
23       - 'github-jjb-merge'
24       - 'github-jjb-verify'
25
26
27 ####################
28 # Anchors & Macros #
29 ####################
30
31 - builder:
32     name: lf-infra-jjbini
33     builders:
34       - config-file-provider:
35           files:
36             - file-id: jjbini
37               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
38
39 - lf_jjb_file_paths: &lf_jjb_file_paths
40     name: lf-jjb-file-paths
41     file-paths:
42       - compare-type: ANT
43         pattern: '**/*.sh'
44       - compare-type: ANT
45         pattern: '**/*.yaml'
46
47 - lf_jjb_merge_builders: &lf_jjb_merge_builders
48     name: lf-jjb-merge-builders
49     builders:
50       - lf-infra-jjbini
51       - shell: !include-raw-escape:
52           - ../shell/jjb-install.sh
53           - ../shell/jjb-merge-job.sh
54
55 - lf_jjb_verify_builders: &lf_jjb_verify_builders
56     name: lf-jjb-verfy-builders
57     builders:
58       - lf-infra-jjbini
59       - shell: !include-raw-escape:
60           - ../shell/jjb-install.sh
61           - ../shell/jjb-verify-job.sh
62           - ../shell/jjb-check-unicode.sh
63       - lf-infra-gpg-verify-git-signature
64
65 - parameter:
66     name: lf-infra-jjb-parameters
67     parameters:
68       - string:
69           name: JJB_VERSION
70           default: '{jjb-version}'
71           description: Jenkins Job Builder version to download and install.
72
73 #################
74 # Job Templates #
75 #################
76
77 # JJB verify and merge jobs are the same except for their scm, trigger, and
78 # builders definition. This anchor is the common template
79 - lf_jjb_verify_merge: &lf_jjb_verify_merge
80     name: lf-jjb-verify-merge
81     project-type: freestyle
82
83     node: '{build-node}'
84
85     ######################
86     # Default parameters #
87     ######################
88
89     branch: master
90     submodule-recursive: true
91
92     #####################
93     # Job Configuration #
94     #####################
95
96     properties:
97       - lf-infra-properties:
98           project: '{project}'
99           build-days-to-keep: 7
100
101     parameters:
102       - lf-infra-parameters:
103           project: '{project}'
104           branch: '{branch}'
105       - lf-infra-jjb-parameters:
106           jjb-version: '{jjb-version}'
107
108     wrappers:
109       - lf-infra-wrappers:
110           build-timeout: 10
111           jenkins-ssh-credential: '{jenkins-ssh-credential}'
112
113     publishers:
114       - lf-infra-publish
115
116 - job-template:
117     name: '{project-name}-jjb-merge'
118     id: gerrit-jjb-merge
119     <<: *lf_jjb_verify_merge
120     # yamllint disable-line rule:key-duplicates
121     <<: *lf_jjb_merge_builders
122
123     scm:
124       - lf-infra-gerrit-scm:
125           jenkins-ssh-credential: '{jenkins-ssh-credential}'
126           refspec: ''
127           branch: '{branch}'
128           submodule-recursive: '{submodule-recursive}'
129           choosing-strategy: default
130
131     triggers:
132       - gerrit:
133           server-name: '{gerrit-server-name}'
134           trigger-on:
135             - change-merged-event
136             - comment-added-contains-event:
137                 comment-contains-value: remerge$
138           projects:
139             - project-compare-type: ANT
140               project-pattern: '{project}'
141               branches:
142                 - branch-compare-type: ANT
143                   branch-pattern: '**/{branch}'
144               <<: *lf_jjb_file_paths
145
146 - job-template:
147     name: '{project-name}-jjb-verify'
148     id: gerrit-jjb-verify
149     concurrent: true
150     <<: *lf_jjb_verify_merge
151     # yamllint disable-line rule:key-duplicates
152     <<: *lf_jjb_verify_builders
153
154     scm:
155       - lf-infra-gerrit-scm:
156           refspec: '$GERRIT_REFSPEC'
157           branch: '$GERRIT_BRANCH'
158           submodule-recursive: '{submodule-recursive}'
159           choosing-strategy: gerrit
160           jenkins-ssh-credential: '{jenkins-ssh-credential}'
161
162     triggers:
163       - gerrit:
164           server-name: '{gerrit-server-name}'
165           trigger-on:
166             - patchset-created-event:
167                 exclude-drafts: false
168                 exclude-trivial-rebase: false
169                 exclude-no-code-change: false
170             - draft-published-event
171             - comment-added-contains-event:
172                 comment-contains-value: recheck$
173           projects:
174             - project-compare-type: ANT
175               project-pattern: '{project}'
176               branches:
177                 - branch-compare-type: ANT
178                   branch-pattern: '**/{branch}'
179               <<: *lf_jjb_file_paths
180
181 - job-template:
182     name: '{project-name}-jjb-merge'
183     id: github-jjb-merge
184     <<: *lf_jjb_verify_merge
185     # yamllint disable-line rule:key-duplicates
186     <<: *lf_jjb_merge_builders
187
188     ######################
189     # Default parameters #
190     ######################
191
192     github-url: https://github.com
193
194     #####################
195     # Job Configuration #
196     #####################
197
198     properties:
199       - github:
200           url: '{github-url}/{github-org}/{project}'
201
202     scm:
203       - lf-infra-github-scm:
204           url: 'git@github.com:{github-org}/{project}'
205           refspec: ''
206           branch: '{branch}'
207           submodule-recursive: '{submodule-recursive}'
208           choosing-strategy: default
209           jenkins-ssh-credential: '{jenkins-ssh-credential}'
210
211     triggers:
212       - github
213       - pollscm:
214           cron: ''
215       - github-pull-request:
216           trigger-phrase: '^remerge$'
217           only-trigger-phrase: true
218           status-context: 'JJB Merge'
219           permit-all: false
220           github-hooks: true
221           auto-close-on-fail: false
222           org-list:
223             - '{github-org}'
224
225 - job-template:
226     name: '{project-name}-jjb-verify'
227     id: github-jjb-verify
228     <<: *lf_jjb_verify_merge
229     # yamllint disable-line rule:key-duplicates
230     <<: *lf_jjb_merge_builders
231
232     ######################
233     # Default parameters #
234     ######################
235
236     github-url: https://github.com
237
238     #####################
239     # Job Configuration #
240     #####################
241
242     properties:
243       - github:
244           url: '{github-url}/{github-org}/{project}'
245
246     scm:
247       - lf-infra-github-scm:
248           url: 'git@github.com:{github-org}/{project}'
249           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
250           branch: '{branch}'
251           submodule-recursive: '{submodule-recursive}'
252           choosing-strategy: default
253           jenkins-ssh-credential: '{jenkins-ssh-credential}'
254
255     triggers:
256       - github-pull-request:
257           trigger-phrase: '^recheck$'
258           only-trigger-phrase: false
259           status-context: 'JJB Verify'
260           permit-all: true
261           github-hooks: true
262           auto-close-on-fail: false