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