Add whitelist and admin-list params to gh trigger
[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/git-validate-jira-urls.sh
61           - ../shell/jjb-install.sh
62           - ../shell/jjb-verify-job.sh
63           - ../shell/jjb-check-unicode.sh
64       - lf-infra-gpg-verify-git-signature
65
66 - parameter:
67     name: lf-infra-jjb-parameters
68     parameters:
69       - string:
70           name: JJB_VERSION
71           default: '{jjb-version}'
72           description: Jenkins Job Builder version to download and install.
73
74 #################
75 # Job Templates #
76 #################
77
78 # JJB verify and merge jobs are the same except for their scm, trigger, and
79 # builders definition. This anchor is the common template
80 - lf_jjb_verify_merge: &lf_jjb_verify_merge
81     name: lf-jjb-verify-merge
82     project-type: freestyle
83
84     node: '{build-node}'
85
86     ######################
87     # Default parameters #
88     ######################
89
90     stream: master
91     branch: master
92     submodule-recursive: true
93
94     #####################
95     # Job Configuration #
96     #####################
97
98     properties:
99       - lf-infra-properties:
100           project: '{project}'
101           build-days-to-keep: 7
102
103     parameters:
104       - lf-infra-parameters:
105           project: '{project}'
106           stream: '{stream}'
107           branch: '{branch}'
108       - lf-infra-jjb-parameters:
109           jjb-version: '{jjb-version}'
110
111     wrappers:
112       - lf-infra-wrappers:
113           build-timeout: 10
114           jenkins-ssh-credential: '{jenkins-ssh-credential}'
115
116     publishers:
117       - lf-infra-publish
118
119 - job-template:
120     name: '{project-name}-jjb-merge'
121     id: gerrit-jjb-merge
122     <<: *lf_jjb_verify_merge
123     # yamllint disable-line rule:key-duplicates
124     <<: *lf_jjb_merge_builders
125
126     ######################
127     # Default parameters #
128     ######################
129
130     git-url: '$GIT_URL/$GERRIT_PROJECT'
131
132     #####################
133     # Job Configuration #
134     #####################
135
136     scm:
137       - lf-infra-gerrit-scm:
138           git-url: '{git-url}'
139           refspec: ''
140           branch: '{branch}'
141           submodule-recursive: '{submodule-recursive}'
142           choosing-strategy: default
143           jenkins-ssh-credential: '{jenkins-ssh-credential}'
144
145     triggers:
146       - gerrit:
147           server-name: '{gerrit-server-name}'
148           trigger-on:
149             - change-merged-event
150             - comment-added-contains-event:
151                 comment-contains-value: remerge$
152           projects:
153             - project-compare-type: ANT
154               project-pattern: '{project}'
155               branches:
156                 - branch-compare-type: ANT
157                   branch-pattern: '**/{branch}'
158               <<: *lf_jjb_file_paths
159
160 - job-template:
161     name: '{project-name}-jjb-verify'
162     id: gerrit-jjb-verify
163     concurrent: true
164     <<: *lf_jjb_verify_merge
165     # yamllint disable-line rule:key-duplicates
166     <<: *lf_jjb_verify_builders
167
168     ######################
169     # Default parameters #
170     ######################
171
172     git-url: '$GIT_URL/$GERRIT_PROJECT'
173
174     #####################
175     # Job Configuration #
176     #####################
177
178     scm:
179       - lf-infra-gerrit-scm:
180           git-url: '{git-url}'
181           refspec: '$GERRIT_REFSPEC'
182           branch: '$GERRIT_BRANCH'
183           submodule-recursive: '{submodule-recursive}'
184           choosing-strategy: gerrit
185           jenkins-ssh-credential: '{jenkins-ssh-credential}'
186
187     triggers:
188       - gerrit:
189           server-name: '{gerrit-server-name}'
190           trigger-on:
191             - patchset-created-event:
192                 exclude-drafts: false
193                 exclude-trivial-rebase: false
194                 exclude-no-code-change: false
195             - draft-published-event
196             - comment-added-contains-event:
197                 comment-contains-value: recheck$
198           projects:
199             - project-compare-type: ANT
200               project-pattern: '{project}'
201               branches:
202                 - branch-compare-type: ANT
203                   branch-pattern: '**/{branch}'
204               <<: *lf_jjb_file_paths
205
206 - job-template:
207     name: '{project-name}-jjb-merge'
208     id: github-jjb-merge
209     <<: *lf_jjb_verify_merge
210     # yamllint disable-line rule:key-duplicates
211     <<: *lf_jjb_merge_builders
212
213     #####################
214     # Job Configuration #
215     #####################
216
217     properties:
218       - github:
219           url: '{git-url}/{github-org}/{project}'
220
221     scm:
222       - lf-infra-github-scm:
223           url: '{git-clone-url}{github-org}/{project}'
224           refspec: ''
225           branch: '{branch}'
226           submodule-recursive: '{submodule-recursive}'
227           choosing-strategy: default
228           jenkins-ssh-credential: '{jenkins-ssh-credential}'
229
230     triggers:
231       - github
232       - pollscm:
233           cron: ''
234       - lf-infra-github-pr-trigger:
235           trigger-phrase: '^remerge$'
236           only-trigger-phrase: true
237           status-context: 'JJB Merge'
238           permit-all: false
239           github-hooks: true
240           github-org: '{github-org}'
241           github_pr_whitelist: '{obj:github_pr_whitelist}'
242           github_pr_admin_list: '{obj:github_pr_admin_list}'
243
244 - job-template:
245     name: '{project-name}-jjb-verify'
246     id: github-jjb-verify
247     concurrent: true
248     <<: *lf_jjb_verify_merge
249     # yamllint disable-line rule:key-duplicates
250     <<: *lf_jjb_verify_builders
251
252     #####################
253     # Job Configuration #
254     #####################
255
256     properties:
257       - github:
258           url: '{git-url}/{github-org}/{project}'
259
260     scm:
261       - lf-infra-github-scm:
262           url: '{git-clone-url}{github-org}/{project}'
263           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
264           branch: '{branch}'
265           submodule-recursive: '{submodule-recursive}'
266           choosing-strategy: default
267           jenkins-ssh-credential: '{jenkins-ssh-credential}'
268
269     triggers:
270       - lf-infra-github-pr-trigger:
271           trigger-phrase: '^recheck$'
272           only-trigger-phrase: false
273           status-context: 'JJB Verify'
274           permit-all: true
275           github-hooks: true
276           github-org: ''
277           github_pr_whitelist:
278             - ''
279           github_pr_admin_list:
280             - ''