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