Pass multiple pattern args in logs-deploy.sh
[releng/global-jjb.git] / jjb / lf-c-cpp-jobs.yaml
1 ---
2 ###############
3 # CMAKE Sonar #
4 ###############
5
6 - lf_cmake_sonar: &lf_cmake_sonar
7     name: lf-cmake-sonar
8
9     ######################
10     # Default parameters #
11     ######################
12
13     branch: master
14     build-days-to-keep: 7
15     build-dir: '$WORKSPACE/target'
16     build-timeout: 15
17     cmake-opts: ''
18     cron: '@daily'
19     disable-job: false
20     git-url: '$GIT_URL/$PROJECT'
21     github-url: 'https://github.com'
22     install-prefix: '$BUILD_DIR/output'
23     make-opts: ''
24     pre-build: ''
25     sonar-scanner-version: 3.3.0.1492
26     sonarcloud-api-token: ''
27     sonarcloud-organization: ''
28     sonarcloud-project-key: ''
29     submodule-recursive: true
30     submodule-timeout: 10
31
32     #####################
33     # Job Configuration #
34     #####################
35
36     project-type: freestyle
37     node: '{build-node}'
38     disabled: '{disable-job}'
39
40     properties:
41       - lf-infra-properties:
42           build-days-to-keep: '{build-days-to-keep}'
43
44     parameters:
45       - lf-infra-parameters:
46           project: '{project}'
47           branch: '{branch}'
48           stream: '{stream}'
49           lftools-version: '{lftools-version}'
50       - lf-cmake-parameters:
51           build-dir: '{build-dir}'
52           cmake-opts: '{cmake-opts}'
53           install-prefix: '{install-prefix}'
54           make-opts: '{make-opts}'
55
56     wrappers:
57       - lf-infra-wrappers:
58           build-timeout: '{build-timeout}'
59           jenkins-ssh-credential: '{jenkins-ssh-credential}'
60
61     builders:
62       - lf-infra-pre-build
63       - shell: '{pre-build}'
64       - inject:
65           # Switch this to the sonar wrapper when JJB 2.0 is available
66           properties-content: |
67             SONAR_HOST_URL=https://sonarcloud.io
68             SONAR_SCANNER_VERSION={sonar-scanner-version}
69             PROJECT_KEY={sonarcloud-project-key}
70             PROJECT_ORGANIZATION={sonarcloud-organization}
71             API_TOKEN={sonarcloud-api-token}
72       - shell: !include-raw-escape: ../shell/cmake-sonar.sh
73       - lf-provide-maven-settings-cleanup
74
75     publishers:
76       - lf-infra-publish
77
78 - job-template:
79     name: '{project-name}-cmake-sonar'
80     id: gerrit-cmake-sonar
81     concurrent: false
82     <<: *lf_cmake_sonar
83
84     scm:
85       - lf-infra-gerrit-scm:
86           branch: '$GERRIT_BRANCH'
87           jenkins-ssh-credential: '{jenkins-ssh-credential}'
88           git-url: '{git-url}'
89           refspec: '$GERRIT_REFSPEC'
90           submodule-recursive: '{submodule-recursive}'
91           submodule-timeout: '{submodule-timeout}'
92           choosing-strategy: gerrit
93
94     triggers:
95       - timed: '{obj:cron}'
96       - gerrit:
97           server-name: '{gerrit-server-name}'
98           trigger-on:
99             - comment-added-contains-event:
100                 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(stage-release)$'
101           projects:
102             - project-compare-type: 'ANT'
103               project-pattern: '{project}'
104               branches:
105                 - branch-compare-type: 'ANT'
106                   branch-pattern: '**/{branch}'
107
108 - job-template:
109     name: '{project-name}-cmake-sonar'
110     id: github-cmake-sonar
111     concurrent: false
112     <<: *lf_cmake_sonar
113
114     properties:
115       - lf-infra-properties:
116           build-days-to-keep: '{build-days-to-keep}'
117       - github:
118           url: '{github-url}/{github-org}/{project}'
119
120     scm:
121       - lf-infra-github-scm:
122           url: '{git-clone-url}{github-org}/{project}'
123           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
124           branch: '$sha1'
125           submodule-recursive: '{submodule-recursive}'
126           submodule-timeout: '{submodule-timeout}'
127           choosing-strategy: default
128           jenkins-ssh-credential: '{jenkins-ssh-credential}'
129
130     triggers:
131       - timed: '{obj:cron}'
132
133
134 ###############
135 # CMAKE STAGE #
136 ###############
137
138 - lf_cmake_stage: &lf_cmake_stage
139     name: lf-cmake-stage
140
141     ######################
142     # Default parameters #
143     ######################
144
145     branch: master
146     build-days-to-keep: 7
147     build-dir: '$WORKSPACE/target'
148     build-timeout: 15
149     cmake-opts: ''
150     cron: '@daily'
151     disable-job: false
152     git-url: '$GIT_URL/$PROJECT'
153     github-url: 'https://github.com'
154     install-prefix: '$BUILD_DIR/output'
155     make-opts: ''
156     mvn-global-settings: global-settings
157     pre-build: ''
158     stream: master
159     submodule-recursive: true
160     submodule-timeout: 10
161     version: ''
162
163     #####################
164     # Job Configuration #
165     #####################
166
167     project-type: freestyle
168     node: '{build-node}'
169     disabled: '{disable-job}'
170
171     properties:
172       - lf-infra-properties:
173           build-days-to-keep: '{build-days-to-keep}'
174
175     parameters:
176       - lf-infra-parameters:
177           project: '{project}'
178           branch: '{branch}'
179           stream: '{stream}'
180       - lf-cmake-parameters:
181           build-dir: '{build-dir}'
182           cmake-opts: '{cmake-opts}'
183           install-prefix: '{install-prefix}'
184           make-opts: '{make-opts}'
185       - string:
186           name: NEXUS_GROUP_ID
187           default: '{nexus-group-id}'
188           description: 'Project Group ID in Nexus to upload to.'
189       - string:
190           name: STAGING_PROFILE_ID
191           default: '{staging-profile-id}'
192           description: 'Nexus staging profile ID.'
193       - string:
194           name: VERSION
195           default: '{version}'
196           description: |
197               (default: '')
198
199               Project version to stage release as. There are 2 methods for
200               using this value:
201
202                   1) Defined explicitly here.
203                   2) Leave this value blank and set /tmp/artifact_version
204
205               Use method 2 in conjunction with 'pre-build' configuration to
206               generate the artifact_version automatically from files in the
207               project's repository. For example with pre-build script:
208
209               #!/bin/bash
210               MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt \
211                   | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
212               MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt \
213                   | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
214               PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt \
215                   | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
216               echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
217
218     wrappers:
219       - lf-infra-wrappers:
220           build-timeout: '{build-timeout}'
221           jenkins-ssh-credential: '{jenkins-ssh-credential}'
222
223     builders:
224       - lf-infra-pre-build
225       - lf-provide-maven-settings:
226           global-settings-file: '{mvn-global-settings}'
227           settings-file: '{mvn-settings}'
228       - lf-infra-create-netrc:
229           server-id: staging
230       - shell: '{pre-build}'
231       - shell: !include-raw-escape: ../shell/cmake-build.sh
232       - shell: !include-raw-escape: ../shell/cmake-stage.sh
233       - lf-provide-maven-settings-cleanup
234
235     publishers:
236       - lf-infra-publish
237
238 - job-template:
239     name: '{project-name}-cmake-stage-{stream}'
240     id: gerrit-cmake-stage
241     concurrent: true
242     <<: *lf_cmake_stage
243
244     scm:
245       - lf-infra-gerrit-scm:
246           branch: '$GERRIT_BRANCH'
247           jenkins-ssh-credential: '{jenkins-ssh-credential}'
248           git-url: '{git-url}'
249           refspec: '$GERRIT_REFSPEC'
250           submodule-recursive: '{submodule-recursive}'
251           submodule-timeout: '{submodule-timeout}'
252           choosing-strategy: gerrit
253
254     triggers:
255       - timed: '{obj:cron}'
256       - gerrit:
257           server-name: '{gerrit-server-name}'
258           trigger-on:
259             - comment-added-contains-event:
260                 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(stage-release)$'
261           projects:
262             - project-compare-type: 'ANT'
263               project-pattern: '{project}'
264               branches:
265                 - branch-compare-type: 'ANT'
266                   branch-pattern: '**/{branch}'
267
268 - job-template:
269     name: '{project-name}-cmake-stage-{stream}'
270     id: github-cmake-stage
271     concurrent: true
272     <<: *lf_cmake_stage
273
274     properties:
275       - lf-infra-properties:
276           build-days-to-keep: '{build-days-to-keep}'
277       - github:
278           url: '{github-url}/{github-org}/{project}'
279
280     scm:
281       - lf-infra-github-scm:
282           url: '{git-clone-url}{github-org}/{project}'
283           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
284           branch: '$sha1'
285           submodule-recursive: '{submodule-recursive}'
286           submodule-timeout: '{submodule-timeout}'
287           choosing-strategy: default
288           jenkins-ssh-credential: '{jenkins-ssh-credential}'
289
290     triggers:
291       - timed: '{obj:cron}'
292       - github-pull-request:
293           trigger-phrase: '^(stage-release)$'
294           only-trigger-phrase: true
295           status-context: 'CMake Stage'
296           permit-all: true
297           github-hooks: true
298           white-list-target-branches:
299             - '{branch}'
300
301
302 ################
303 # CMAKE VERIFY #
304 ################
305
306 - lf_cmake_verify: &lf_cmake_verify
307     name: lf-cmake-verify
308
309     ######################
310     # Default parameters #
311     ######################
312
313     branch: master
314     build-days-to-keep: 7
315     build-dir: '$WORKSPACE/target'
316     build-timeout: 15
317     cmake-opts: ''
318     disable-job: false
319     git-url: '$GIT_URL/$PROJECT'
320     github-url: 'https://github.com'
321     install-prefix: '$BUILD_DIR/output'
322     make-opts: ''
323     pre-build: ''
324     stream: master
325     submodule-recursive: true
326     submodule-timeout: 10
327
328     gerrit_verify_triggers:
329       - patchset-created-event:
330           exclude-drafts: true
331           exclude-trivial-rebase: false
332           exclude-no-code-change: false
333       - draft-published-event
334       - comment-added-contains-event:
335           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
336
337     gerrit_trigger_file_paths:
338       - compare-type: REG_EXP
339         pattern: '.*'
340
341     # github_included_regions MUST match gerrit_trigger_file_paths
342     github_included_regions:
343       - '.*'
344
345     #####################
346     # Job Configuration #
347     #####################
348
349     project-type: freestyle
350     node: '{build-node}'
351     disabled: '{disable-job}'
352
353     properties:
354       - lf-infra-properties:
355           build-days-to-keep: '{build-days-to-keep}'
356
357     parameters:
358       - lf-infra-parameters:
359           project: '{project}'
360           branch: '{branch}'
361           stream: '{stream}'
362       - lf-cmake-parameters:
363           build-dir: '{build-dir}'
364           cmake-opts: '{cmake-opts}'
365           install-prefix: '{install-prefix}'
366           make-opts: '{make-opts}'
367
368     wrappers:
369       - lf-infra-wrappers:
370           build-timeout: '{build-timeout}'
371           jenkins-ssh-credential: '{jenkins-ssh-credential}'
372
373     builders:
374       - shell: '{pre-build}'
375       - shell: !include-raw-escape: ../shell/cmake-build.sh
376
377     publishers:
378       - lf-infra-publish
379
380 - job-template:
381     name: '{project-name}-cmake-verify-{stream}'
382     id: gerrit-cmake-verify
383     concurrent: true
384     <<: *lf_cmake_verify
385
386     scm:
387       - lf-infra-gerrit-scm:
388           branch: '$GERRIT_BRANCH'
389           jenkins-ssh-credential: '{jenkins-ssh-credential}'
390           git-url: '{git-url}'
391           refspec: '$GERRIT_REFSPEC'
392           submodule-recursive: '{submodule-recursive}'
393           submodule-timeout: '{submodule-timeout}'
394           choosing-strategy: gerrit
395
396     triggers:
397       - gerrit:
398           server-name: '{gerrit-server-name}'
399           trigger-on: '{obj:gerrit_verify_triggers}'
400           projects:
401             - project-compare-type: 'ANT'
402               project-pattern: '{project}'
403               branches:
404                 - branch-compare-type: 'ANT'
405                   branch-pattern: '**/{branch}'
406               file-paths: '{obj:gerrit_trigger_file_paths}'
407
408 - job-template:
409     name: '{project-name}-cmake-verify-{stream}'
410     id: github-cmake-verify
411     concurrent: true
412     <<: *lf_cmake_verify
413
414     properties:
415       - lf-infra-properties:
416           build-days-to-keep: '{build-days-to-keep}'
417       - github:
418           url: '{github-url}/{github-org}/{project}'
419
420     scm:
421       - lf-infra-github-scm:
422           url: '{git-clone-url}{github-org}/{project}'
423           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
424           branch: '$sha1'
425           submodule-recursive: '{submodule-recursive}'
426           submodule-timeout: '{submodule-timeout}'
427           choosing-strategy: default
428           jenkins-ssh-credential: '{jenkins-ssh-credential}'
429
430     triggers:
431       - github-pull-request:
432           trigger-phrase: '^(recheck|reverify)$'
433           only-trigger-phrase: false
434           status-context: 'CMake Verify'
435           permit-all: true
436           github-hooks: true
437           included-regions: '{obj:github_included_regions}'
438           white-list-target-branches:
439             - '{branch}'