Fix: Update lf-infra-sonar macro to use JDK version
[releng/global-jjb.git] / jjb / lf-c-cpp-jobs.yaml
1 ---
2 ####################
3 # AUTOTOOLS COMMON #
4 ####################
5
6 - _lf_autotools_common: &lf_autotools_common
7     name: lf-autotools-common
8
9     #####################
10     # Job Configuration #
11     #####################
12
13     project-type: freestyle
14     node: "{build-node}"
15     disabled: "{disable-job}"
16
17     properties:
18       - lf-infra-properties:
19           build-days-to-keep: "{build-days-to-keep}"
20
21     parameters:
22       - lf-infra-parameters:
23           project: "{project}"
24           branch: "{branch}"
25           stream: "{stream}"
26       - lf-autotools-parameters:
27           configure-opts: "{configure-opts}"
28           install-prefix: "{install-prefix}"
29           make-opts: "{make-opts}"
30
31     wrappers:
32       - lf-infra-wrappers:
33           build-timeout: "{build-timeout}"
34           jenkins-ssh-credential: "{jenkins-ssh-credential}"
35
36     publishers:
37       - lf-infra-publish
38
39 ################################
40 # AUTOTOOLS PACKAGECLOUD STAGE #
41 ################################
42
43 - _lf_autotools_packagecloud_stage: &lf_autotools_packagecloud_stage
44     name: lf-autotools-packagecloud-stage
45
46     ######################
47     # Default parameters #
48     ######################
49
50     branch: master
51     build-days-to-keep: 7
52     build-dir: "$WORKSPACE" # directory with deb/rpm files
53     build-timeout: 15
54     configure-opts: ""
55     disable-job: false
56     git-url: "$GIT_URL/$PROJECT"
57     github-url: "https://github.com"
58     install: false
59     install-prefix: $WORKSPACE/output
60     make-opts: "" # target that creates deb/rpm files
61     pre-build: | # default script to generate configure file
62       autoreconf --install
63     stream: master
64     submodule-recursive: true
65     submodule-timeout: 10
66     submodule-disable: false
67
68     gerrit_trigger_file_paths:
69       - compare-type: REG_EXP
70         pattern: ".*"
71
72     # github_included_regions MUST match gerrit_trigger_file_paths
73     github_included_regions:
74       - ".*"
75
76     parameters:
77       - lf-infra-parameters:
78           project: "{project}"
79           branch: "{branch}"
80           stream: "{stream}"
81       - lf-autotools-parameters:
82           configure-opts: "{configure-opts}"
83           install-prefix: "{install-prefix}"
84           make-opts: "{make-opts}"
85       - bool:
86           name: INSTALL
87           default: "{install}"
88           description: "Install build products to /usr/local (true/false)."
89
90     builders:
91       - config-file-provider:
92           files:
93             - file-id: ".packagecloud"
94               target: "$HOME/.packagecloud"
95       - shell: "{pre-build}"
96       - shell: !include-raw-escape: ../shell/autotools-build.sh
97       - lf-packagecloud-push:
98           build-dir: "{build-dir}"
99           packagecloud-account: "{packagecloud-account}"
100           packagecloud-repo: "{packagecloud-repo}"
101           debian-distribution-versions: "{debian-distribution-versions}"
102           rpm-distribution-versions: "{rpm-distribution-versions}"
103
104 - job-template:
105     # build with configure/make and publish to PackageCloud on command
106     name: "{project-name}-autotools-packagecloud-stage-{stream}"
107     id: gerrit-autotools-packagecloud-stage
108     <<: *lf_autotools_common
109     <<: *lf_autotools_packagecloud_stage
110
111     ######################
112     # Default parameters #
113     ######################
114
115     gerrit_stage_triggers:
116       - comment-added-contains-event:
117           comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$'
118
119     #####################
120     # Job Configuration #
121     #####################
122
123     scm:
124       - lf-infra-gerrit-scm:
125           jenkins-ssh-credential: "{jenkins-ssh-credential}"
126           git-url: "{git-url}"
127           refspec: "$GERRIT_REFSPEC"
128           branch: "$GERRIT_BRANCH"
129           submodule-recursive: "{submodule-recursive}"
130           submodule-timeout: "{submodule-timeout}"
131           submodule-disable: "{submodule-disable}"
132           # stage jobs always build from tip
133           choosing-strategy: default
134
135     triggers:
136       - gerrit:
137           server-name: "{gerrit-server-name}"
138           trigger-on: "{obj:gerrit_stage_triggers}"
139           projects:
140             - project-compare-type: ANT
141               project-pattern: "{project}"
142               branches:
143                 - branch-compare-type: ANT
144                   branch-pattern: "**/{branch}"
145               file-paths: "{obj:gerrit_trigger_file_paths}"
146
147 - job-template:
148     name: "{project-name}-autotools-packagecloud-stage-{stream}"
149     id: github-autotools-packagecloud-stage
150     concurrent: true
151     <<: *lf_autotools_common
152     <<: *lf_autotools_packagecloud_stage
153
154     properties:
155       - lf-infra-properties:
156           build-days-to-keep: "{build-days-to-keep}"
157       - github:
158           url: "{github-url}/{github-org}/{project}"
159
160     scm:
161       - lf-infra-github-scm:
162           url: "{git-clone-url}{github-org}/{project}"
163           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
164           branch: "$sha1"
165           submodule-recursive: "{submodule-recursive}"
166           submodule-timeout: "{submodule-timeout}"
167           submodule-disable: "{submodule-disable}"
168           choosing-strategy: default
169           jenkins-ssh-credential: "{jenkins-ssh-credential}"
170
171     triggers:
172       - github-pull-request:
173           trigger-phrase: "^(stage-release)$"
174           only-trigger-phrase: true
175           status-context: "Autotools PackageCloud Stage"
176           permit-all: true
177           github-hooks: true
178           white-list-target-branches:
179             - "{branch}"
180
181 #######################
182 # AUTOTOOLS SONARQUBE #
183 #######################
184
185 - _lf_autotools_sonarqube: &lf_autotools_sonarqube
186     name: lf-autotools-sonarqube
187
188     ######################
189     # Default parameters #
190     ######################
191
192     branch: master # Sonar should always be run on master branch
193     build-days-to-keep: 7
194     build-timeout: 15
195     build-wrap-dir: $WORKSPACE/bw-output
196     configure-opts: CXXFLAGS="-O0 --coverage" LDFLAGS=--coverage # gcc coverage options
197     cron: "@weekly"
198     disable-job: false
199     git-url: "$GIT_URL/$PROJECT"
200     github-url: "https://github.com"
201     install-prefix: $WORKSPACE/output
202     make-opts: "" # target that tests and generates gcov files
203     pre-build: | # default script to generate configure file
204       autoreconf --install
205     stream: master
206     submodule-recursive: true
207     submodule-timeout: 10
208     submodule-disable: false
209
210     # Sonar properties
211     sonar-additional-args: ""
212     sonar-java-opts: ""
213     sonar-project-file: sonar-project.properties
214     sonar-properties: ""
215     sonar-task: ""
216     sonar-jdk: openjdk17
217
218     parameters:
219       - lf-infra-parameters:
220           project: "{project}"
221           branch: "{branch}"
222           stream: "{stream}"
223       - lf-autotools-parameters:
224           configure-opts: "{configure-opts}"
225           install-prefix: "{install-prefix}"
226           make-opts: "{make-opts}"
227       - string:
228           name: BUILD_WRAP_DIR
229           default: "{build-wrap-dir}"
230           description: SonarQube build wrapper output directory
231
232     builders:
233       - shell: "{pre-build}"
234       - shell: !include-raw-escape: ../shell/autotools-sonarqube.sh
235       - lf-infra-sonar:
236           sonar-task: "{sonar-task}"
237           sonar-project-file: "{sonar-project-file}"
238           sonar-properties: "{sonar-properties}"
239           sonar-java-opts: "{sonar-java-opts}"
240           sonar-additional-args: "{sonar-additional-args}"
241           sonar-jdk: "{sonar-jdk}"
242
243 - job-template:
244     name: "{project-name}-autotools-sonarqube"
245     id: gerrit-autotools-sonarqube
246     concurrent: false
247     <<: *lf_autotools_common
248     <<: *lf_autotools_sonarqube
249
250     gerrit_sonar_triggers:
251       - comment-added-contains-event:
252           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
253
254     scm:
255       - lf-infra-gerrit-scm:
256           branch: "$GERRIT_BRANCH"
257           jenkins-ssh-credential: "{jenkins-ssh-credential}"
258           git-url: "{git-url}"
259           refspec: "$GERRIT_REFSPEC"
260           submodule-recursive: "{submodule-recursive}"
261           submodule-timeout: "{submodule-timeout}"
262           submodule-disable: "{submodule-disable}"
263           choosing-strategy: default
264
265     triggers:
266       - timed: "{obj:cron}"
267       - gerrit:
268           server-name: "{gerrit-server-name}"
269           trigger-on: "{obj:gerrit_sonar_triggers}"
270           projects:
271             - project-compare-type: "ANT"
272               project-pattern: "{project}"
273               branches:
274                 - branch-compare-type: "ANT"
275                   branch-pattern: "**/{branch}"
276
277 - job-template:
278     name: "{project-name}-autotools-sonarqube"
279     id: github-autotools-sonarqube
280     concurrent: false
281     <<: *lf_autotools_common
282     <<: *lf_autotools_sonarqube
283
284     scm:
285       - lf-infra-github-scm:
286           branch: "$sha1"
287           jenkins-ssh-credential: "{jenkins-ssh-credential}"
288           url: "{git-clone-url}{github-org}/{project}"
289           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
290           submodule-recursive: "{submodule-recursive}"
291           submodule-timeout: "{submodule-timeout}"
292           submodule-disable: "{submodule-disable}"
293           choosing-strategy: default
294
295     triggers:
296       - github-pull-request:
297           trigger-phrase: "^run-sonar$"
298           only-trigger-phrase: false
299           status-context: "Autotools Sonarqube"
300           permit-all: true
301           github-hooks: true
302           white-list-target-branches:
303             - "{branch}"
304
305 ####################
306 # AUTOTOOLS VERIFY #
307 ####################
308
309 - _lf_autotools_verify: &lf_autotools_verify
310     name: lf-autotools-verify
311
312     ######################
313     # Default parameters #
314     ######################
315
316     branch: master
317     build-days-to-keep: 7
318     build-timeout: 15
319     configure-opts: ""
320     disable-job: false
321     git-url: "$GIT_URL/$PROJECT"
322     github-url: "https://github.com"
323     install: false
324     install-prefix: $WORKSPACE/output
325     make-opts: "test" # target that compiles and tests
326     pre-build: | # default script to generate configure file
327       autoreconf --install
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     parameters:
351       - lf-infra-parameters:
352           project: "{project}"
353           branch: "{branch}"
354           stream: "{stream}"
355       - lf-autotools-parameters:
356           configure-opts: "{configure-opts}"
357           install-prefix: "{install-prefix}"
358           make-opts: "{make-opts}"
359       - bool:
360           name: INSTALL
361           default: "{install}"
362           description: "Install build products to /usr/local (true/false)."
363
364     builders:
365       - shell: "{pre-build}"
366       - shell: !include-raw-escape: ../shell/autotools-build.sh
367
368 - job-template:
369     name: "{project-name}-autotools-verify-{stream}"
370     id: gerrit-autotools-verify
371     concurrent: true
372     <<: *lf_autotools_common
373     <<: *lf_autotools_verify
374
375     scm:
376       - lf-infra-gerrit-scm:
377           branch: "$GERRIT_BRANCH"
378           jenkins-ssh-credential: "{jenkins-ssh-credential}"
379           git-url: "{git-url}"
380           refspec: "$GERRIT_REFSPEC"
381           submodule-recursive: "{submodule-recursive}"
382           submodule-timeout: "{submodule-timeout}"
383           submodule-disable: "{submodule-disable}"
384           choosing-strategy: gerrit
385
386     triggers:
387       - gerrit:
388           server-name: "{gerrit-server-name}"
389           trigger-on: "{obj:gerrit_verify_triggers}"
390           projects:
391             - project-compare-type: "ANT"
392               project-pattern: "{project}"
393               branches:
394                 - branch-compare-type: "ANT"
395                   branch-pattern: "**/{branch}"
396               file-paths: "{obj:gerrit_trigger_file_paths}"
397
398 - job-template:
399     name: "{project-name}-autotools-verify-{stream}"
400     id: github-autotools-verify
401     concurrent: true
402     <<: *lf_autotools_common
403     <<: *lf_autotools_verify
404
405     properties:
406       - lf-infra-properties:
407           build-days-to-keep: "{build-days-to-keep}"
408       - github:
409           url: "{github-url}/{github-org}/{project}"
410
411     scm:
412       - lf-infra-github-scm:
413           url: "{git-clone-url}{github-org}/{project}"
414           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
415           branch: "$sha1"
416           submodule-recursive: "{submodule-recursive}"
417           submodule-timeout: "{submodule-timeout}"
418           submodule-disable: "{submodule-disable}"
419           choosing-strategy: default
420           jenkins-ssh-credential: "{jenkins-ssh-credential}"
421
422     triggers:
423       - github-pull-request:
424           trigger-phrase: "^(recheck|reverify)$"
425           only-trigger-phrase: false
426           status-context: "Autotools Verify"
427           permit-all: true
428           github-hooks: true
429           included-regions: "{obj:github_included_regions}"
430           white-list-target-branches:
431             - "{branch}"
432
433 ################
434 # CMAKE COMMON #
435 ################
436
437 - _lf_cmake_common: &lf_cmake_common
438     name: lf-cmake-common
439
440     #####################
441     # Job Configuration #
442     #####################
443
444     project-type: freestyle
445     node: "{build-node}"
446     disabled: "{disable-job}"
447
448     properties:
449       - lf-infra-properties:
450           build-days-to-keep: "{build-days-to-keep}"
451
452     parameters:
453       - lf-infra-parameters:
454           project: "{project}"
455           branch: "{branch}"
456           stream: "{stream}"
457       - lf-cmake-parameters:
458           build-dir: "{build-dir}"
459           cmake-opts: "{cmake-opts}"
460           install-prefix: "{install-prefix}"
461           make-opts: "{make-opts}"
462
463     wrappers:
464       - lf-infra-wrappers:
465           build-timeout: "{build-timeout}"
466           jenkins-ssh-credential: "{jenkins-ssh-credential}"
467
468     publishers:
469       - lf-infra-publish
470
471 ###############
472 # CMAKE SONAR #
473 ###############
474
475 - _lf_cmake_sonar: &lf_cmake_sonar
476     name: lf-cmake-sonar
477
478     ######################
479     # Default parameters #
480     ######################
481
482     branch: master
483     build-days-to-keep: 7
484     build-dir: "$WORKSPACE/target"
485     build-timeout: 15
486     cmake-opts: ""
487     cron: "@daily"
488     disable-job: false
489     git-url: "$GIT_URL/$PROJECT"
490     github-url: "https://github.com"
491     install-prefix: "$BUILD_DIR/output"
492     make-opts: ""
493     pre-build: ""
494     sonar-scanner-version: 3.3.0.1492
495     sonarcloud-api-token-cred-id: sonarcloud-api-token
496     sonarcloud-organization: ""
497     sonarcloud-project-key: ""
498     stream: master
499     submodule-recursive: true
500     submodule-timeout: 10
501     submodule-disable: false
502
503     builders:
504       - lf-infra-pre-build
505       - shell: "{pre-build}"
506       - inject:
507           # Switch this to the sonar wrapper when JJB 2.0 is available
508           properties-content: |
509             SONAR_HOST_URL=https://sonarcloud.io
510             SONAR_SCANNER_VERSION={sonar-scanner-version}
511             PROJECT_KEY={sonarcloud-project-key}
512             PROJECT_ORGANIZATION={sonarcloud-organization}
513       - shell: !include-raw-escape: ../shell/cmake-sonar.sh
514       - lf-provide-maven-settings-cleanup
515
516     wrappers:
517       - credentials-binding:
518           - text:
519               credential-id: "{sonarcloud-api-token-cred-id}"
520               variable: API_TOKEN
521
522 - job-template:
523     name: "{project-name}-cmake-sonar"
524     id: gerrit-cmake-sonar
525     concurrent: false
526     <<: *lf_cmake_common
527     <<: *lf_cmake_sonar
528
529     scm:
530       - lf-infra-gerrit-scm:
531           branch: "$GERRIT_BRANCH"
532           jenkins-ssh-credential: "{jenkins-ssh-credential}"
533           git-url: "{git-url}"
534           refspec: "$GERRIT_REFSPEC"
535           submodule-recursive: "{submodule-recursive}"
536           submodule-timeout: "{submodule-timeout}"
537           submodule-disable: "{submodule-disable}"
538           choosing-strategy: gerrit
539
540     triggers:
541       - timed: "{obj:cron}"
542       - gerrit:
543           server-name: "{gerrit-server-name}"
544           trigger-on:
545             - comment-added-contains-event:
546                 comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
547           projects:
548             - project-compare-type: "ANT"
549               project-pattern: "{project}"
550               branches:
551                 - branch-compare-type: "ANT"
552                   branch-pattern: "**/{branch}"
553
554 - job-template:
555     name: "{project-name}-cmake-sonar"
556     id: github-cmake-sonar
557     concurrent: false
558     <<: *lf_cmake_common
559     <<: *lf_cmake_sonar
560
561     properties:
562       - lf-infra-properties:
563           build-days-to-keep: "{build-days-to-keep}"
564       - github:
565           url: "{github-url}/{github-org}/{project}"
566
567     scm:
568       - lf-infra-github-scm:
569           url: "{git-clone-url}{github-org}/{project}"
570           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
571           branch: "$sha1"
572           submodule-recursive: "{submodule-recursive}"
573           submodule-timeout: "{submodule-timeout}"
574           submodule-disable: "{submodule-disable}"
575           choosing-strategy: default
576           jenkins-ssh-credential: "{jenkins-ssh-credential}"
577
578     triggers:
579       - timed: "{obj:cron}"
580
581 ###################
582 # CMAKE SONARQUBE #
583 ###################
584
585 - _lf_cmake_sonarqube: &lf_cmake_sonarqube
586     name: lf-cmake-sonarqube
587
588     ######################
589     # Default parameters #
590     ######################
591
592     archive-artifacts: >
593       **/*.log
594     branch: master # Sonar should always be run on master branch
595     build-days-to-keep: 7
596     build-dir: "$WORKSPACE/build"
597     build-timeout: 15
598     build-wrap-dir: "$WORKSPACE/bw-output"
599     cmake-opts: ""
600     cron: "@weekly"
601     disable-job: false
602     git-url: "$GIT_URL/$PROJECT"
603     github-url: "https://github.com"
604     install-prefix: "$BUILD_DIR/output"
605     make-opts: ""
606     pre-build: ""
607     stream: master
608     submodule-recursive: true
609     submodule-timeout: 10
610     submodule-disable: false
611
612     # Sonar properties
613     sonar-additional-args: ""
614     sonar-java-opts: ""
615     sonar-project-file: "sonar-project.properties"
616     sonar-properties: ""
617     sonar-task: ""
618     sonar-jdk: openjdk17
619
620     parameters:
621       - lf-infra-parameters:
622           project: "{project}"
623           branch: "{branch}"
624           stream: "{stream}"
625       - lf-cmake-parameters:
626           build-dir: "{build-dir}"
627           cmake-opts: "{cmake-opts}"
628           install-prefix: "{install-prefix}"
629           make-opts: "{make-opts}"
630       - string:
631           name: ARCHIVE_ARTIFACTS
632           default: "{archive-artifacts}"
633           description: Artifacts to archive to the logs server.
634       - string:
635           name: BUILD_WRAP_DIR
636           default: "{build-wrap-dir}"
637           description: SonarQube build wrapper output directory.
638
639     builders:
640       - lf-infra-pre-build
641       - shell: "{pre-build}"
642       - shell: !include-raw-escape: ../shell/cmake-sonarqube.sh
643       - lf-infra-sonar:
644           sonar-task: "{sonar-task}"
645           sonar-project-file: "{sonar-project-file}"
646           sonar-properties: "{sonar-properties}"
647           sonar-java-opts: "{sonar-java-opts}"
648           sonar-additional-args: "{sonar-additional-args}"
649           sonar-jdk: "{sonar-jdk}"
650
651 - job-template:
652     name: "{project-name}-cmake-sonarqube"
653     id: gerrit-cmake-sonarqube
654     concurrent: false
655     <<: *lf_cmake_common
656     <<: *lf_cmake_sonarqube
657
658     gerrit_sonar_triggers:
659       - comment-added-contains-event:
660           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
661
662     scm:
663       - lf-infra-gerrit-scm:
664           branch: "$GERRIT_BRANCH"
665           jenkins-ssh-credential: "{jenkins-ssh-credential}"
666           git-url: "{git-url}"
667           refspec: "$GERRIT_REFSPEC"
668           submodule-recursive: "{submodule-recursive}"
669           submodule-timeout: "{submodule-timeout}"
670           submodule-disable: "{submodule-disable}"
671           choosing-strategy: default
672
673     triggers:
674       - timed: "{obj:cron}"
675       - gerrit:
676           server-name: "{gerrit-server-name}"
677           trigger-on: "{obj:gerrit_sonar_triggers}"
678           projects:
679             - project-compare-type: "ANT"
680               project-pattern: "{project}"
681               branches:
682                 - branch-compare-type: "ANT"
683                   branch-pattern: "**/{branch}"
684
685 - job-template:
686     name: "{project-name}-cmake-sonarqube"
687     id: github-cmake-sonarqube
688     concurrent: false
689     <<: *lf_cmake_common
690     <<: *lf_cmake_sonarqube
691
692     scm:
693       - lf-infra-github-scm:
694           branch: "$sha1"
695           jenkins-ssh-credential: "{jenkins-ssh-credential}"
696           url: "{git-clone-url}{github-org}/{project}"
697           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
698           submodule-recursive: "{submodule-recursive}"
699           submodule-timeout: "{submodule-timeout}"
700           submodule-disable: "{submodule-disable}"
701           choosing-strategy: default
702
703     triggers:
704       - github-pull-request:
705           trigger-phrase: "^run-sonar$"
706           only-trigger-phrase: false
707           status-context: "CMake Sonarqube"
708           permit-all: true
709           github-hooks: true
710           white-list-target-branches:
711             - "{branch}"
712
713 ###############
714 # CMAKE STAGE #
715 ###############
716
717 - _lf_cmake_stage: &lf_cmake_stage
718     name: lf-cmake-stage
719
720     ######################
721     # Default parameters #
722     ######################
723
724     branch: master
725     build-days-to-keep: 7
726     build-dir: "$WORKSPACE/target"
727     build-timeout: 15
728     cmake-opts: ""
729     cron: "@daily"
730     disable-job: false
731     git-url: "$GIT_URL/$PROJECT"
732     github-url: "https://github.com"
733     install: true
734     install-prefix: "$BUILD_DIR/output"
735     make-opts: ""
736     mvn-global-settings: global-settings
737     pre-build: ""
738     stream: master
739     submodule-recursive: true
740     submodule-timeout: 10
741     submodule-disable: false
742     version: ""
743
744     parameters:
745       - lf-infra-parameters:
746           project: "{project}"
747           branch: "{branch}"
748           stream: "{stream}"
749       - lf-cmake-parameters:
750           build-dir: "{build-dir}"
751           cmake-opts: "{cmake-opts}"
752           install-prefix: "{install-prefix}"
753           make-opts: "{make-opts}"
754       - bool:
755           name: INSTALL
756           default: "{install}"
757           description: "Install build products to /usr/local (true/false)."
758       - string:
759           name: NEXUS_GROUP_ID
760           default: "{nexus-group-id}"
761           description: "Project Group ID in Nexus to upload to."
762       - string:
763           name: STAGING_PROFILE_ID
764           default: "{staging-profile-id}"
765           description: "Nexus staging profile ID."
766       - string:
767           name: VERSION
768           default: "{version}"
769           description: |
770             (default: '')
771
772             Project version to stage release as. There are 2 methods for
773             using this value:
774
775                 1) Defined explicitly here.
776                 2) Leave this value blank and set /tmp/artifact_version
777
778             Use method 2 in conjunction with 'pre-build' configuration to
779             generate the artifact_version automatically from files in the
780             project's repository. For example with pre-build script:
781
782             #!/bin/bash
783             MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt \
784                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
785             MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt \
786                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
787             PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt \
788                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
789             echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
790
791     builders:
792       - lf-infra-pre-build
793       - lf-provide-maven-settings:
794           global-settings-file: "{mvn-global-settings}"
795           settings-file: "{mvn-settings}"
796       - lf-infra-create-netrc:
797           server-id: staging
798       - shell: "{pre-build}"
799       - shell: !include-raw-escape: ../shell/cmake-build.sh
800       - shell: !include-raw-escape: ../shell/cmake-stage.sh
801       - lf-provide-maven-settings-cleanup
802
803 - job-template:
804     name: "{project-name}-cmake-stage-{stream}"
805     id: gerrit-cmake-stage
806     concurrent: true
807     <<: *lf_cmake_common
808     <<: *lf_cmake_stage
809
810     scm:
811       - lf-infra-gerrit-scm:
812           branch: "$GERRIT_BRANCH"
813           jenkins-ssh-credential: "{jenkins-ssh-credential}"
814           git-url: "{git-url}"
815           refspec: "$GERRIT_REFSPEC"
816           submodule-recursive: "{submodule-recursive}"
817           submodule-timeout: "{submodule-timeout}"
818           submodule-disable: "{submodule-disable}"
819           choosing-strategy: gerrit
820
821     triggers:
822       - timed: "{obj:cron}"
823       - gerrit:
824           server-name: "{gerrit-server-name}"
825           trigger-on:
826             - comment-added-contains-event:
827                 comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$'
828           projects:
829             - project-compare-type: "ANT"
830               project-pattern: "{project}"
831               branches:
832                 - branch-compare-type: "ANT"
833                   branch-pattern: "**/{branch}"
834
835 - job-template:
836     name: "{project-name}-cmake-stage-{stream}"
837     id: github-cmake-stage
838     concurrent: true
839     <<: *lf_cmake_common
840     <<: *lf_cmake_stage
841
842     properties:
843       - lf-infra-properties:
844           build-days-to-keep: "{build-days-to-keep}"
845       - github:
846           url: "{github-url}/{github-org}/{project}"
847
848     scm:
849       - lf-infra-github-scm:
850           url: "{git-clone-url}{github-org}/{project}"
851           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
852           branch: "$sha1"
853           submodule-recursive: "{submodule-recursive}"
854           submodule-timeout: "{submodule-timeout}"
855           submodule-disable: "{submodule-disable}"
856           choosing-strategy: default
857           jenkins-ssh-credential: "{jenkins-ssh-credential}"
858
859     triggers:
860       - timed: "{obj:cron}"
861       - github-pull-request:
862           trigger-phrase: "^(stage-release)$"
863           only-trigger-phrase: true
864           status-context: "CMake Stage"
865           permit-all: true
866           github-hooks: true
867           white-list-target-branches:
868             - "{branch}"
869
870 ############################
871 # CMAKE PACKAGECLOUD STAGE #
872 ############################
873
874 - _lf_cmake_pc_stage: &lf_cmake_pc_stage
875     name: lf-cmake-packagecloud-stage
876
877     ######################
878     # Default parameters #
879     ######################
880
881     branch: master
882     build-days-to-keep: 7
883     build-dir: "$WORKSPACE/build"
884     build-timeout: 15
885     cmake-opts: ""
886     disable-job: false
887     git-url: "$GIT_URL/$PROJECT"
888     github-url: "https://github.com"
889     install: false
890     install-prefix: "$BUILD_DIR/output"
891     make-opts: ""
892     pre-build: ""
893     stream: master
894     submodule-recursive: true
895     submodule-timeout: 10
896     submodule-disable: false
897
898     gerrit_trigger_file_paths:
899       - compare-type: REG_EXP
900         pattern: ".*"
901
902     # github_included_regions MUST match gerrit_trigger_file_paths
903     github_included_regions:
904       - ".*"
905
906     parameters:
907       - lf-infra-parameters:
908           project: "{project}"
909           branch: "{branch}"
910           stream: "{stream}"
911       - lf-cmake-parameters:
912           build-dir: "{build-dir}"
913           cmake-opts: "{cmake-opts}"
914           install-prefix: "{install-prefix}"
915           make-opts: "{make-opts}"
916       - bool:
917           name: INSTALL
918           default: "{install}"
919           description: "Install build products to /usr/local (true/false)."
920
921     builders:
922       - config-file-provider:
923           files:
924             - file-id: ".packagecloud"
925               target: "$HOME/.packagecloud"
926       - shell: "{pre-build}"
927       - shell: !include-raw-escape: ../shell/cmake-build.sh
928       - lf-packagecloud-push:
929           build-dir: "{build-dir}"
930           packagecloud-account: "{packagecloud-account}"
931           packagecloud-repo: "{packagecloud-repo}"
932           debian-distribution-versions: "{debian-distribution-versions}"
933           rpm-distribution-versions: "{rpm-distribution-versions}"
934
935 - job-template:
936     # build with cmake and publish to PackageCloud on command
937     name: "{project-name}-cmake-packagecloud-stage-{stream}"
938     id: gerrit-cmake-packagecloud-stage
939     <<: *lf_cmake_common
940     <<: *lf_cmake_pc_stage
941
942     ######################
943     # Default parameters #
944     ######################
945
946     gerrit_stage_triggers:
947       - comment-added-contains-event:
948           comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$'
949
950     #####################
951     # Job Configuration #
952     #####################
953
954     scm:
955       - lf-infra-gerrit-scm:
956           jenkins-ssh-credential: "{jenkins-ssh-credential}"
957           git-url: "{git-url}"
958           refspec: "$GERRIT_REFSPEC"
959           branch: "$GERRIT_BRANCH"
960           submodule-recursive: "{submodule-recursive}"
961           submodule-timeout: "{submodule-timeout}"
962           submodule-disable: "{submodule-disable}"
963           # stage jobs always build from tip
964           choosing-strategy: default
965
966     triggers:
967       - gerrit:
968           server-name: "{gerrit-server-name}"
969           trigger-on: "{obj:gerrit_stage_triggers}"
970           projects:
971             - project-compare-type: ANT
972               project-pattern: "{project}"
973               branches:
974                 - branch-compare-type: ANT
975                   branch-pattern: "**/{branch}"
976               file-paths: "{obj:gerrit_trigger_file_paths}"
977
978 - job-template:
979     name: "{project-name}-cmake-packagecloud-stage-{stream}"
980     id: github-cmake-packagecloud-stage
981     concurrent: true
982     <<: *lf_cmake_common
983     <<: *lf_cmake_pc_stage
984
985     properties:
986       - lf-infra-properties:
987           build-days-to-keep: "{build-days-to-keep}"
988       - github:
989           url: "{github-url}/{github-org}/{project}"
990
991     scm:
992       - lf-infra-github-scm:
993           url: "{git-clone-url}{github-org}/{project}"
994           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
995           branch: "$sha1"
996           submodule-recursive: "{submodule-recursive}"
997           submodule-timeout: "{submodule-timeout}"
998           submodule-disable: "{submodule-disable}"
999           choosing-strategy: default
1000           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1001
1002     triggers:
1003       - github-pull-request:
1004           trigger-phrase: "^(stage-release)$"
1005           only-trigger-phrase: true
1006           status-context: "CMake PackageCloud Stage"
1007           permit-all: true
1008           github-hooks: true
1009           white-list-target-branches:
1010             - "{branch}"
1011
1012 ################
1013 # CMAKE VERIFY #
1014 ################
1015
1016 - _lf_cmake_verify: &lf_cmake_verify
1017     name: lf-cmake-verify
1018
1019     ######################
1020     # Default parameters #
1021     ######################
1022
1023     branch: master
1024     build-days-to-keep: 7
1025     build-dir: "$WORKSPACE/target"
1026     build-timeout: 15
1027     cmake-opts: ""
1028     disable-job: false
1029     git-url: "$GIT_URL/$PROJECT"
1030     github-url: "https://github.com"
1031     install: true
1032     install-prefix: "$BUILD_DIR/output"
1033     make-opts: ""
1034     pre-build: ""
1035     stream: master
1036     submodule-recursive: true
1037     submodule-timeout: 10
1038     submodule-disable: false
1039
1040     gerrit_verify_triggers:
1041       - patchset-created-event:
1042           exclude-drafts: true
1043           exclude-trivial-rebase: false
1044           exclude-no-code-change: false
1045       - draft-published-event
1046       - comment-added-contains-event:
1047           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1048
1049     gerrit_trigger_file_paths:
1050       - compare-type: REG_EXP
1051         pattern: ".*"
1052
1053     # github_included_regions MUST match gerrit_trigger_file_paths
1054     github_included_regions:
1055       - ".*"
1056
1057     parameters:
1058       - lf-infra-parameters:
1059           project: "{project}"
1060           branch: "{branch}"
1061           stream: "{stream}"
1062       - lf-cmake-parameters:
1063           build-dir: "{build-dir}"
1064           cmake-opts: "{cmake-opts}"
1065           install-prefix: "{install-prefix}"
1066           make-opts: "{make-opts}"
1067       - bool:
1068           name: INSTALL
1069           default: "{install}"
1070           description: "Install build products to /usr/local (true/false)."
1071
1072     builders:
1073       - shell: "{pre-build}"
1074       - shell: !include-raw-escape: ../shell/cmake-build.sh
1075
1076 - job-template:
1077     name: "{project-name}-cmake-verify-{stream}"
1078     id: gerrit-cmake-verify
1079     concurrent: true
1080     <<: *lf_cmake_common
1081     <<: *lf_cmake_verify
1082
1083     scm:
1084       - lf-infra-gerrit-scm:
1085           branch: "$GERRIT_BRANCH"
1086           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1087           git-url: "{git-url}"
1088           refspec: "$GERRIT_REFSPEC"
1089           submodule-recursive: "{submodule-recursive}"
1090           submodule-timeout: "{submodule-timeout}"
1091           submodule-disable: "{submodule-disable}"
1092           choosing-strategy: gerrit
1093
1094     triggers:
1095       - gerrit:
1096           server-name: "{gerrit-server-name}"
1097           trigger-on: "{obj:gerrit_verify_triggers}"
1098           projects:
1099             - project-compare-type: "ANT"
1100               project-pattern: "{project}"
1101               branches:
1102                 - branch-compare-type: "ANT"
1103                   branch-pattern: "**/{branch}"
1104               file-paths: "{obj:gerrit_trigger_file_paths}"
1105
1106 - job-template:
1107     name: "{project-name}-cmake-verify-{stream}"
1108     id: github-cmake-verify
1109     concurrent: true
1110     <<: *lf_cmake_common
1111     <<: *lf_cmake_verify
1112
1113     properties:
1114       - lf-infra-properties:
1115           build-days-to-keep: "{build-days-to-keep}"
1116       - github:
1117           url: "{github-url}/{github-org}/{project}"
1118
1119     scm:
1120       - lf-infra-github-scm:
1121           url: "{git-clone-url}{github-org}/{project}"
1122           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1123           branch: "$sha1"
1124           submodule-recursive: "{submodule-recursive}"
1125           submodule-timeout: "{submodule-timeout}"
1126           submodule-disable: "{submodule-disable}"
1127           choosing-strategy: default
1128           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1129
1130     triggers:
1131       - github-pull-request:
1132           trigger-phrase: "^(recheck|reverify)$"
1133           only-trigger-phrase: false
1134           status-context: "CMake Verify"
1135           permit-all: true
1136           github-hooks: true
1137           included-regions: "{obj:github_included_regions}"
1138           white-list-target-branches:
1139             - "{branch}"