Refactor: pre-commit cleanups
[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-cred-id: 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       - shell: !include-raw-escape: ../shell/cmake-sonar.sh
512       - lf-provide-maven-settings-cleanup
513
514     wrappers:
515       - credentials-binding:
516           - text:
517               credential-id: "{sonarcloud-api-token-cred-id}"
518               variable: API_TOKEN
519
520 - job-template:
521     name: "{project-name}-cmake-sonar"
522     id: gerrit-cmake-sonar
523     concurrent: false
524     <<: *lf_cmake_common
525     <<: *lf_cmake_sonar
526
527     scm:
528       - lf-infra-gerrit-scm:
529           branch: "$GERRIT_BRANCH"
530           jenkins-ssh-credential: "{jenkins-ssh-credential}"
531           git-url: "{git-url}"
532           refspec: "$GERRIT_REFSPEC"
533           submodule-recursive: "{submodule-recursive}"
534           submodule-timeout: "{submodule-timeout}"
535           submodule-disable: "{submodule-disable}"
536           choosing-strategy: gerrit
537
538     triggers:
539       - timed: "{obj:cron}"
540       - gerrit:
541           server-name: "{gerrit-server-name}"
542           trigger-on:
543             - comment-added-contains-event:
544                 comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
545           projects:
546             - project-compare-type: "ANT"
547               project-pattern: "{project}"
548               branches:
549                 - branch-compare-type: "ANT"
550                   branch-pattern: "**/{branch}"
551
552 - job-template:
553     name: "{project-name}-cmake-sonar"
554     id: github-cmake-sonar
555     concurrent: false
556     <<: *lf_cmake_common
557     <<: *lf_cmake_sonar
558
559     properties:
560       - lf-infra-properties:
561           build-days-to-keep: "{build-days-to-keep}"
562       - github:
563           url: "{github-url}/{github-org}/{project}"
564
565     scm:
566       - lf-infra-github-scm:
567           url: "{git-clone-url}{github-org}/{project}"
568           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
569           branch: "$sha1"
570           submodule-recursive: "{submodule-recursive}"
571           submodule-timeout: "{submodule-timeout}"
572           submodule-disable: "{submodule-disable}"
573           choosing-strategy: default
574           jenkins-ssh-credential: "{jenkins-ssh-credential}"
575
576     triggers:
577       - timed: "{obj:cron}"
578
579 ###################
580 # CMAKE SONARQUBE #
581 ###################
582
583 - lf_cmake_sonarqube: &lf_cmake_sonarqube
584     name: lf-cmake-sonarqube
585
586     ######################
587     # Default parameters #
588     ######################
589
590     archive-artifacts: >
591       **/*.log
592     branch: master # Sonar should always be run on master branch
593     build-days-to-keep: 7
594     build-dir: "$WORKSPACE/build"
595     build-timeout: 15
596     build-wrap-dir: "$WORKSPACE/bw-output"
597     cmake-opts: ""
598     cron: "@weekly"
599     disable-job: false
600     git-url: "$GIT_URL/$PROJECT"
601     github-url: "https://github.com"
602     install-prefix: "$BUILD_DIR/output"
603     make-opts: ""
604     pre-build: ""
605     stream: master
606     submodule-recursive: true
607     submodule-timeout: 10
608     submodule-disable: false
609
610     # Sonar properties
611     sonar-additional-args: ""
612     sonar-java-opts: ""
613     sonar-project-file: "sonar-project.properties"
614     sonar-properties: ""
615     sonar-task: ""
616
617     parameters:
618       - lf-infra-parameters:
619           project: "{project}"
620           branch: "{branch}"
621           stream: "{stream}"
622       - lf-cmake-parameters:
623           build-dir: "{build-dir}"
624           cmake-opts: "{cmake-opts}"
625           install-prefix: "{install-prefix}"
626           make-opts: "{make-opts}"
627       - string:
628           name: ARCHIVE_ARTIFACTS
629           default: "{archive-artifacts}"
630           description: Artifacts to archive to the logs server.
631       - string:
632           name: BUILD_WRAP_DIR
633           default: "{build-wrap-dir}"
634           description: SonarQube build wrapper output directory.
635
636     builders:
637       - lf-infra-pre-build
638       - shell: "{pre-build}"
639       - shell: !include-raw-escape: ../shell/cmake-sonarqube.sh
640       - lf-infra-sonar:
641           sonar-task: "{sonar-task}"
642           sonar-project-file: "{sonar-project-file}"
643           sonar-properties: "{sonar-properties}"
644           sonar-java-opts: "{sonar-java-opts}"
645           sonar-additional-args: "{sonar-additional-args}"
646
647 - job-template:
648     name: "{project-name}-cmake-sonarqube"
649     id: gerrit-cmake-sonarqube
650     concurrent: false
651     <<: *lf_cmake_common
652     <<: *lf_cmake_sonarqube
653
654     gerrit_sonar_triggers:
655       - comment-added-contains-event:
656           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
657
658     scm:
659       - lf-infra-gerrit-scm:
660           branch: "$GERRIT_BRANCH"
661           jenkins-ssh-credential: "{jenkins-ssh-credential}"
662           git-url: "{git-url}"
663           refspec: "$GERRIT_REFSPEC"
664           submodule-recursive: "{submodule-recursive}"
665           submodule-timeout: "{submodule-timeout}"
666           submodule-disable: "{submodule-disable}"
667           choosing-strategy: default
668
669     triggers:
670       - timed: "{obj:cron}"
671       - gerrit:
672           server-name: "{gerrit-server-name}"
673           trigger-on: "{obj:gerrit_sonar_triggers}"
674           projects:
675             - project-compare-type: "ANT"
676               project-pattern: "{project}"
677               branches:
678                 - branch-compare-type: "ANT"
679                   branch-pattern: "**/{branch}"
680
681 - job-template:
682     name: "{project-name}-cmake-sonarqube"
683     id: github-cmake-sonarqube
684     concurrent: false
685     <<: *lf_cmake_common
686     <<: *lf_cmake_sonarqube
687
688     scm:
689       - lf-infra-github-scm:
690           branch: "$sha1"
691           jenkins-ssh-credential: "{jenkins-ssh-credential}"
692           url: "{git-clone-url}{github-org}/{project}"
693           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
694           submodule-recursive: "{submodule-recursive}"
695           submodule-timeout: "{submodule-timeout}"
696           submodule-disable: "{submodule-disable}"
697           choosing-strategy: default
698
699     triggers:
700       - github-pull-request:
701           trigger-phrase: "^run-sonar$"
702           only-trigger-phrase: false
703           status-context: "CMake Sonarqube"
704           permit-all: true
705           github-hooks: true
706           white-list-target-branches:
707             - "{branch}"
708
709 ###############
710 # CMAKE STAGE #
711 ###############
712
713 - lf_cmake_stage: &lf_cmake_stage
714     name: lf-cmake-stage
715
716     ######################
717     # Default parameters #
718     ######################
719
720     branch: master
721     build-days-to-keep: 7
722     build-dir: "$WORKSPACE/target"
723     build-timeout: 15
724     cmake-opts: ""
725     cron: "@daily"
726     disable-job: false
727     git-url: "$GIT_URL/$PROJECT"
728     github-url: "https://github.com"
729     install: true
730     install-prefix: "$BUILD_DIR/output"
731     make-opts: ""
732     mvn-global-settings: global-settings
733     pre-build: ""
734     stream: master
735     submodule-recursive: true
736     submodule-timeout: 10
737     submodule-disable: false
738     version: ""
739
740     parameters:
741       - lf-infra-parameters:
742           project: "{project}"
743           branch: "{branch}"
744           stream: "{stream}"
745       - lf-cmake-parameters:
746           build-dir: "{build-dir}"
747           cmake-opts: "{cmake-opts}"
748           install-prefix: "{install-prefix}"
749           make-opts: "{make-opts}"
750       - bool:
751           name: INSTALL
752           default: "{install}"
753           description: "Install build products to /usr/local (true/false)."
754       - string:
755           name: NEXUS_GROUP_ID
756           default: "{nexus-group-id}"
757           description: "Project Group ID in Nexus to upload to."
758       - string:
759           name: STAGING_PROFILE_ID
760           default: "{staging-profile-id}"
761           description: "Nexus staging profile ID."
762       - string:
763           name: VERSION
764           default: "{version}"
765           description: |
766             (default: '')
767
768             Project version to stage release as. There are 2 methods for
769             using this value:
770
771                 1) Defined explicitly here.
772                 2) Leave this value blank and set /tmp/artifact_version
773
774             Use method 2 in conjunction with 'pre-build' configuration to
775             generate the artifact_version automatically from files in the
776             project's repository. For example with pre-build script:
777
778             #!/bin/bash
779             MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt \
780                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
781             MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt \
782                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
783             PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt \
784                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
785             echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
786
787     builders:
788       - lf-infra-pre-build
789       - lf-provide-maven-settings:
790           global-settings-file: "{mvn-global-settings}"
791           settings-file: "{mvn-settings}"
792       - lf-infra-create-netrc:
793           server-id: staging
794       - shell: "{pre-build}"
795       - shell: !include-raw-escape: ../shell/cmake-build.sh
796       - shell: !include-raw-escape: ../shell/cmake-stage.sh
797       - lf-provide-maven-settings-cleanup
798
799 - job-template:
800     name: "{project-name}-cmake-stage-{stream}"
801     id: gerrit-cmake-stage
802     concurrent: true
803     <<: *lf_cmake_common
804     <<: *lf_cmake_stage
805
806     scm:
807       - lf-infra-gerrit-scm:
808           branch: "$GERRIT_BRANCH"
809           jenkins-ssh-credential: "{jenkins-ssh-credential}"
810           git-url: "{git-url}"
811           refspec: "$GERRIT_REFSPEC"
812           submodule-recursive: "{submodule-recursive}"
813           submodule-timeout: "{submodule-timeout}"
814           submodule-disable: "{submodule-disable}"
815           choosing-strategy: gerrit
816
817     triggers:
818       - timed: "{obj:cron}"
819       - gerrit:
820           server-name: "{gerrit-server-name}"
821           trigger-on:
822             - comment-added-contains-event:
823                 comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$'
824           projects:
825             - project-compare-type: "ANT"
826               project-pattern: "{project}"
827               branches:
828                 - branch-compare-type: "ANT"
829                   branch-pattern: "**/{branch}"
830
831 - job-template:
832     name: "{project-name}-cmake-stage-{stream}"
833     id: github-cmake-stage
834     concurrent: true
835     <<: *lf_cmake_common
836     <<: *lf_cmake_stage
837
838     properties:
839       - lf-infra-properties:
840           build-days-to-keep: "{build-days-to-keep}"
841       - github:
842           url: "{github-url}/{github-org}/{project}"
843
844     scm:
845       - lf-infra-github-scm:
846           url: "{git-clone-url}{github-org}/{project}"
847           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
848           branch: "$sha1"
849           submodule-recursive: "{submodule-recursive}"
850           submodule-timeout: "{submodule-timeout}"
851           submodule-disable: "{submodule-disable}"
852           choosing-strategy: default
853           jenkins-ssh-credential: "{jenkins-ssh-credential}"
854
855     triggers:
856       - timed: "{obj:cron}"
857       - github-pull-request:
858           trigger-phrase: "^(stage-release)$"
859           only-trigger-phrase: true
860           status-context: "CMake Stage"
861           permit-all: true
862           github-hooks: true
863           white-list-target-branches:
864             - "{branch}"
865
866 ############################
867 # CMAKE PACKAGECLOUD STAGE #
868 ############################
869
870 - lf_cmake_pc_stage: &lf_cmake_pc_stage
871     name: lf-cmake-packagecloud-stage
872
873     ######################
874     # Default parameters #
875     ######################
876
877     branch: master
878     build-days-to-keep: 7
879     build-dir: "$WORKSPACE/build"
880     build-timeout: 15
881     cmake-opts: ""
882     disable-job: false
883     git-url: "$GIT_URL/$PROJECT"
884     github-url: "https://github.com"
885     install: false
886     install-prefix: "$BUILD_DIR/output"
887     make-opts: ""
888     pre-build: ""
889     stream: master
890     submodule-recursive: true
891     submodule-timeout: 10
892     submodule-disable: false
893
894     gerrit_trigger_file_paths:
895       - compare-type: REG_EXP
896         pattern: ".*"
897
898     # github_included_regions MUST match gerrit_trigger_file_paths
899     github_included_regions:
900       - ".*"
901
902     parameters:
903       - lf-infra-parameters:
904           project: "{project}"
905           branch: "{branch}"
906           stream: "{stream}"
907       - lf-cmake-parameters:
908           build-dir: "{build-dir}"
909           cmake-opts: "{cmake-opts}"
910           install-prefix: "{install-prefix}"
911           make-opts: "{make-opts}"
912       - bool:
913           name: INSTALL
914           default: "{install}"
915           description: "Install build products to /usr/local (true/false)."
916
917     builders:
918       - config-file-provider:
919           files:
920             - file-id: ".packagecloud"
921               target: "$HOME/.packagecloud"
922       - shell: "{pre-build}"
923       - shell: !include-raw-escape: ../shell/cmake-build.sh
924       - lf-packagecloud-push:
925           build-dir: "{build-dir}"
926           packagecloud-account: "{packagecloud-account}"
927           packagecloud-repo: "{packagecloud-repo}"
928           debian-distribution-versions: "{debian-distribution-versions}"
929           rpm-distribution-versions: "{rpm-distribution-versions}"
930
931 - job-template:
932     # build with cmake and publish to PackageCloud on command
933     name: "{project-name}-cmake-packagecloud-stage-{stream}"
934     id: gerrit-cmake-packagecloud-stage
935     <<: *lf_cmake_common
936     <<: *lf_cmake_pc_stage
937
938     ######################
939     # Default parameters #
940     ######################
941
942     gerrit_stage_triggers:
943       - comment-added-contains-event:
944           comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$'
945
946     #####################
947     # Job Configuration #
948     #####################
949
950     scm:
951       - lf-infra-gerrit-scm:
952           jenkins-ssh-credential: "{jenkins-ssh-credential}"
953           git-url: "{git-url}"
954           refspec: "$GERRIT_REFSPEC"
955           branch: "$GERRIT_BRANCH"
956           submodule-recursive: "{submodule-recursive}"
957           submodule-timeout: "{submodule-timeout}"
958           submodule-disable: "{submodule-disable}"
959           # stage jobs always build from tip
960           choosing-strategy: default
961
962     triggers:
963       - gerrit:
964           server-name: "{gerrit-server-name}"
965           trigger-on: "{obj:gerrit_stage_triggers}"
966           projects:
967             - project-compare-type: ANT
968               project-pattern: "{project}"
969               branches:
970                 - branch-compare-type: ANT
971                   branch-pattern: "**/{branch}"
972               file-paths: "{obj:gerrit_trigger_file_paths}"
973
974 - job-template:
975     name: "{project-name}-cmake-packagecloud-stage-{stream}"
976     id: github-cmake-packagecloud-stage
977     concurrent: true
978     <<: *lf_cmake_common
979     <<: *lf_cmake_pc_stage
980
981     properties:
982       - lf-infra-properties:
983           build-days-to-keep: "{build-days-to-keep}"
984       - github:
985           url: "{github-url}/{github-org}/{project}"
986
987     scm:
988       - lf-infra-github-scm:
989           url: "{git-clone-url}{github-org}/{project}"
990           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
991           branch: "$sha1"
992           submodule-recursive: "{submodule-recursive}"
993           submodule-timeout: "{submodule-timeout}"
994           submodule-disable: "{submodule-disable}"
995           choosing-strategy: default
996           jenkins-ssh-credential: "{jenkins-ssh-credential}"
997
998     triggers:
999       - github-pull-request:
1000           trigger-phrase: "^(stage-release)$"
1001           only-trigger-phrase: true
1002           status-context: "CMake PackageCloud Stage"
1003           permit-all: true
1004           github-hooks: true
1005           white-list-target-branches:
1006             - "{branch}"
1007
1008 ################
1009 # CMAKE VERIFY #
1010 ################
1011
1012 - lf_cmake_verify: &lf_cmake_verify
1013     name: lf-cmake-verify
1014
1015     ######################
1016     # Default parameters #
1017     ######################
1018
1019     branch: master
1020     build-days-to-keep: 7
1021     build-dir: "$WORKSPACE/target"
1022     build-timeout: 15
1023     cmake-opts: ""
1024     disable-job: false
1025     git-url: "$GIT_URL/$PROJECT"
1026     github-url: "https://github.com"
1027     install: true
1028     install-prefix: "$BUILD_DIR/output"
1029     make-opts: ""
1030     pre-build: ""
1031     stream: master
1032     submodule-recursive: true
1033     submodule-timeout: 10
1034     submodule-disable: false
1035
1036     gerrit_verify_triggers:
1037       - patchset-created-event:
1038           exclude-drafts: true
1039           exclude-trivial-rebase: false
1040           exclude-no-code-change: false
1041       - draft-published-event
1042       - comment-added-contains-event:
1043           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1044
1045     gerrit_trigger_file_paths:
1046       - compare-type: REG_EXP
1047         pattern: ".*"
1048
1049     # github_included_regions MUST match gerrit_trigger_file_paths
1050     github_included_regions:
1051       - ".*"
1052
1053     parameters:
1054       - lf-infra-parameters:
1055           project: "{project}"
1056           branch: "{branch}"
1057           stream: "{stream}"
1058       - lf-cmake-parameters:
1059           build-dir: "{build-dir}"
1060           cmake-opts: "{cmake-opts}"
1061           install-prefix: "{install-prefix}"
1062           make-opts: "{make-opts}"
1063       - bool:
1064           name: INSTALL
1065           default: "{install}"
1066           description: "Install build products to /usr/local (true/false)."
1067
1068     builders:
1069       - shell: "{pre-build}"
1070       - shell: !include-raw-escape: ../shell/cmake-build.sh
1071
1072 - job-template:
1073     name: "{project-name}-cmake-verify-{stream}"
1074     id: gerrit-cmake-verify
1075     concurrent: true
1076     <<: *lf_cmake_common
1077     <<: *lf_cmake_verify
1078
1079     scm:
1080       - lf-infra-gerrit-scm:
1081           branch: "$GERRIT_BRANCH"
1082           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1083           git-url: "{git-url}"
1084           refspec: "$GERRIT_REFSPEC"
1085           submodule-recursive: "{submodule-recursive}"
1086           submodule-timeout: "{submodule-timeout}"
1087           submodule-disable: "{submodule-disable}"
1088           choosing-strategy: gerrit
1089
1090     triggers:
1091       - gerrit:
1092           server-name: "{gerrit-server-name}"
1093           trigger-on: "{obj:gerrit_verify_triggers}"
1094           projects:
1095             - project-compare-type: "ANT"
1096               project-pattern: "{project}"
1097               branches:
1098                 - branch-compare-type: "ANT"
1099                   branch-pattern: "**/{branch}"
1100               file-paths: "{obj:gerrit_trigger_file_paths}"
1101
1102 - job-template:
1103     name: "{project-name}-cmake-verify-{stream}"
1104     id: github-cmake-verify
1105     concurrent: true
1106     <<: *lf_cmake_common
1107     <<: *lf_cmake_verify
1108
1109     properties:
1110       - lf-infra-properties:
1111           build-days-to-keep: "{build-days-to-keep}"
1112       - github:
1113           url: "{github-url}/{github-org}/{project}"
1114
1115     scm:
1116       - lf-infra-github-scm:
1117           url: "{git-clone-url}{github-org}/{project}"
1118           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1119           branch: "$sha1"
1120           submodule-recursive: "{submodule-recursive}"
1121           submodule-timeout: "{submodule-timeout}"
1122           submodule-disable: "{submodule-disable}"
1123           choosing-strategy: default
1124           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1125
1126     triggers:
1127       - github-pull-request:
1128           trigger-phrase: "^(recheck|reverify)$"
1129           only-trigger-phrase: false
1130           status-context: "CMake Verify"
1131           permit-all: true
1132           github-hooks: true
1133           included-regions: "{obj:github_included_regions}"
1134           white-list-target-branches:
1135             - "{branch}"