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