5e854484eaa34de7af98a6a2ddaad5690373ef8d
[releng/global-jjb.git] / jjb / lf-c-cpp-jobs.yaml
1 ---
2 ###############
3 # CMAKE STAGE #
4 ###############
5
6 - lf_cmake_stage: &lf_cmake_stage
7     name: lf-cmake-stage
8
9     ######################
10     # Default parameters #
11     ######################
12
13     branch: master
14     build-days-to-keep: 7
15     build-dir: '$WORKSPACE/target'
16     build-timeout: 15
17     cmake-opts: ''
18     cron: '@daily'
19     git-url: '$GIT_URL/$PROJECT'
20     github-url: 'https://github.com'
21     install-prefix: '$BUILD_DIR/output'
22     make-opts: ''
23     mvn-global-settings: global-settings
24     pre-build: ''
25     stream: master
26     submodule-recursive: true
27     version: ''
28
29     #####################
30     # Job Configuration #
31     #####################
32
33     project-type: freestyle
34     node: '{build-node}'
35
36     properties:
37       - lf-infra-properties:
38           build-days-to-keep: '{build-days-to-keep}'
39
40     parameters:
41       - lf-infra-parameters:
42           project: '{project}'
43           branch: '{branch}'
44           stream: '{stream}'
45           lftools-version: '{lftools-version}'
46       - lf-cmake-parameters:
47           build-dir: '{build-dir}'
48           cmake-opts: '{cmake-opts}'
49           install-prefix: '{install-prefix}'
50           make-opts: '{make-opts}'
51       - string:
52           name: NEXUS_GROUP_ID
53           default: '{nexus-group-id}'
54           description: 'Project Group ID in Nexus to upload to.'
55       - string:
56           name: STAGING_PROFILE_ID
57           default: '{staging-profile-id}'
58           description: 'Nexus staging profile ID.'
59       - string:
60           name: VERSION
61           default: '{version}'
62           description: |
63               (default: '')
64
65               Project version to stage release as. There are 2 methods for
66               using this value:
67
68                   1) Defined explicitly here.
69                   2) Leave this value blank and set /tmp/artifact_version
70
71               Use method 2 in conjunction with 'pre-build' configuration to
72               generate the artifact_version automatically from files in the
73               project's repository. For example with pre-build script:
74
75               #!/bin/bash
76               MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt \
77                   | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
78               MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt \
79                   | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
80               PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt \
81                   | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
82               echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
83
84     wrappers:
85       - lf-infra-wrappers:
86           build-timeout: '{build-timeout}'
87           jenkins-ssh-credential: '{jenkins-ssh-credential}'
88
89     builders:
90       - shell: !include-raw-escape: ../shell/lftools-install.sh
91       - lf-provide-maven-settings:
92           global-settings-file: '{mvn-global-settings}'
93           settings-file: '{mvn-settings}'
94       - lf-infra-create-netrc:
95           server-id: staging
96       - shell: '{pre-build}'
97       - shell: !include-raw-escape: ../shell/cmake-build.sh
98       - shell: !include-raw-escape: ../shell/cmake-stage.sh
99       - lf-provide-maven-settings-cleanup
100
101     publishers:
102       - lf-infra-publish
103
104 - job-template:
105     name: '{project-name}-cmake-stage-{stream}'
106     id: gerrit-cmake-stage
107     concurrent: true
108     <<: *lf_cmake_stage
109
110     scm:
111       - lf-infra-gerrit-scm:
112           branch: '$GERRIT_BRANCH'
113           jenkins-ssh-credential: '{jenkins-ssh-credential}'
114           git-url: '{git-url}'
115           refspec: '$GERRIT_REFSPEC'
116           submodule-recursive: '{submodule-recursive}'
117           choosing-strategy: gerrit
118
119     triggers:
120       - timed: '{obj:cron}'
121       - gerrit:
122           server-name: '{gerrit-server-name}'
123           trigger-on:
124             - comment-added-contains-event:
125                 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(stage-release)$'
126           projects:
127             - project-compare-type: 'ANT'
128               project-pattern: '{project}'
129               branches:
130                 - branch-compare-type: 'ANT'
131                   branch-pattern: '**/{branch}'
132
133 - job-template:
134     name: '{project-name}-cmake-stage-{stream}'
135     id: github-cmake-stage
136     concurrent: true
137     <<: *lf_cmake_stage
138
139     properties:
140       - lf-infra-properties:
141           build-days-to-keep: '{build-days-to-keep}'
142       - github:
143           url: '{github-url}/{github-org}/{project}'
144
145     scm:
146       - lf-infra-github-scm:
147           url: '{git-clone-url}{github-org}/{project}'
148           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
149           branch: '$sha1'
150           submodule-recursive: '{submodule-recursive}'
151           choosing-strategy: default
152           jenkins-ssh-credential: '{jenkins-ssh-credential}'
153
154     triggers:
155       - timed: '{obj:cron}'
156       - github-pull-request:
157           trigger-phrase: '^(stage-release)$'
158           only-trigger-phrase: true
159           status-context: 'CMake Stage'
160           permit-all: true
161           github-hooks: true
162           white-list-target-branches:
163             - '{branch}'
164
165
166 ################
167 # CMAKE VERIFY #
168 ################
169
170 - lf_cmake_verify: &lf_cmake_verify
171     name: lf-cmake-verify
172
173     ######################
174     # Default parameters #
175     ######################
176
177     branch: master
178     build-days-to-keep: 7
179     build-dir: '$WORKSPACE/target'
180     build-timeout: 15
181     cmake-opts: ''
182     git-url: '$GIT_URL/$PROJECT'
183     github-url: 'https://github.com'
184     install-prefix: '$BUILD_DIR/output'
185     make-opts: ''
186     pre-build: ''
187     stream: master
188     submodule-recursive: true
189
190     gerrit_verify_triggers:
191       - patchset-created-event:
192           exclude-drafts: true
193           exclude-trivial-rebase: false
194           exclude-no-code-change: false
195       - draft-published-event
196       - comment-added-contains-event:
197           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
198
199     gerrit_trigger_file_paths:
200       - compare-type: REG_EXP
201         pattern: '.*'
202
203     # github_included_regions MUST match gerrit_trigger_file_paths
204     github_included_regions:
205       - '.*'
206
207     #####################
208     # Job Configuration #
209     #####################
210
211     project-type: freestyle
212     node: '{build-node}'
213
214     properties:
215       - lf-infra-properties:
216           build-days-to-keep: '{build-days-to-keep}'
217
218     parameters:
219       - lf-infra-parameters:
220           project: '{project}'
221           branch: '{branch}'
222           stream: '{stream}'
223           lftools-version: '{lftools-version}'
224       - lf-cmake-parameters:
225           build-dir: '{build-dir}'
226           cmake-opts: '{cmake-opts}'
227           install-prefix: '{install-prefix}'
228           make-opts: '{make-opts}'
229
230     wrappers:
231       - lf-infra-wrappers:
232           build-timeout: '{build-timeout}'
233           jenkins-ssh-credential: '{jenkins-ssh-credential}'
234
235     builders:
236       - shell: '{pre-build}'
237       - shell: !include-raw-escape: ../shell/cmake-build.sh
238
239     publishers:
240       - lf-infra-publish
241
242 - job-template:
243     name: '{project-name}-cmake-verify-{stream}'
244     id: gerrit-cmake-verify
245     concurrent: true
246     <<: *lf_cmake_verify
247
248     scm:
249       - lf-infra-gerrit-scm:
250           branch: '$GERRIT_BRANCH'
251           jenkins-ssh-credential: '{jenkins-ssh-credential}'
252           git-url: '{git-url}'
253           refspec: '$GERRIT_REFSPEC'
254           submodule-recursive: '{submodule-recursive}'
255           choosing-strategy: gerrit
256
257     triggers:
258       - gerrit:
259           server-name: '{gerrit-server-name}'
260           trigger-on: '{obj:gerrit_verify_triggers}'
261           projects:
262             - project-compare-type: 'ANT'
263               project-pattern: '{project}'
264               branches:
265                 - branch-compare-type: 'ANT'
266                   branch-pattern: '**/{branch}'
267               file-paths: '{obj:gerrit_trigger_file_paths}'
268
269 - job-template:
270     name: '{project-name}-cmake-verify-{stream}'
271     id: github-cmake-verify
272     concurrent: true
273     <<: *lf_cmake_verify
274
275     properties:
276       - lf-infra-properties:
277           build-days-to-keep: '{build-days-to-keep}'
278       - github:
279           url: '{github-url}/{github-org}/{project}'
280
281     scm:
282       - lf-infra-github-scm:
283           url: '{git-clone-url}{github-org}/{project}'
284           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
285           branch: '$sha1'
286           submodule-recursive: '{submodule-recursive}'
287           choosing-strategy: default
288           jenkins-ssh-credential: '{jenkins-ssh-credential}'
289
290     triggers:
291       - github-pull-request:
292           trigger-phrase: '^(recheck|reverify)$'
293           only-trigger-phrase: false
294           status-context: 'CMake Verify'
295           permit-all: true
296           github-hooks: true
297           included-regions: '{obj:github_included_regions}'
298           white-list-target-branches:
299             - '{branch}'