deb_dpdk: use bionic image for CI builds
[ci-management.git] / jjb / global-macros.yaml
1 # Global macros
2
3 #### PARAMETERS
4 - parameter:
5     name: project-parameter
6     parameters:
7         - string:
8             name: PROJECT
9             default: '{project}'
10             description: "JJB configured PROJECT parameter to identify a Gerrit project"
11
12 - parameter:
13     name: gerrit-parameter
14     parameters:
15         - string:
16             name: GERRIT_BRANCH
17             default: '{branch}'
18             description: "JJB configured GERRIT_BRANCH parameter"
19
20 - parameter:
21     name: gerrit-project-parameter
22     parameters:
23         - string:
24             name: GERRIT_PROJECT
25             default: '{project}'
26             description: "GERRIT_PROJECT parameter if not given by trigger"
27
28 - parameter:
29     name: os-parameter
30     parameters:
31         - string:
32             name: OS
33             default: '{os}'
34             description: "OS parameter"
35
36 - parameter:
37     name: gerrit-refspec-parameter
38     parameters:
39         - string:
40             name: GERRIT_REFSPEC
41             default: '{refspec}'
42             description: "GERRIT_REFSPEC parameter not given by trigger"
43
44 - parameter:
45     name: maven-project-parameter
46     parameters:
47         - string:
48             name: MAVEN_SELECTOR
49             default: '{maven}'
50             description: 'Maven selector to be used by shell scripts'
51
52 - parameter:
53     name: maven-exec
54     parameters:
55       - string:
56           name: MVN
57           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
58           description: 'Maven selector to be used by shell scripts'
59
60 - parameter:
61     name: repo-name-parameter
62     parameters:
63         - string:
64             name: REPO_NAME
65             default: '{repo-name}'
66             description: 'Name of repo to which to publish packaging'
67
68 - parameter:
69     name: compiler-parameter
70     parameters:
71         - string:
72             name: CC
73             default: '{cc}'
74             description: "CC parameter, can be gnu or clang"
75
76 - parameter:
77     name: is-csit-vpp-job-parameter
78     parameters:
79         - string:
80             name: IS_CSIT_VPP_JOB
81             default: '{is-csit-vpp-job}'
82             description: "Parameter is True if this is a CSIT vpp job."
83
84 - parameter:
85     name: stream-parameter
86     parameters:
87         - string:
88             name: STREAM
89             default: '{stream}'
90             description: "Stream job parameter to be used in shell scripts."
91
92
93 ##### SCMS
94 - scm:
95     name: git-scm
96     scm:
97         - git:
98             credentials-id: '{credentials-id}'
99             url: '$GIT_BASE'
100             refspec: ''
101             branches:
102                 - 'origin/{branch}'
103             skip-tag: true
104             wipe-workspace: true
105
106 - scm:
107     name: gerrit-trigger-scm
108     scm:
109         - git:
110             credentials-id: '{credentials-id}'
111             url: '$GIT_BASE'
112             refspec: '{refspec}'
113             branches:
114                 - 'origin/$GERRIT_BRANCH'
115             skip-tag: true
116             choosing-strategy: '{choosing-strategy}'
117
118 - scm:
119     name: zuul-trigger-scm
120     scm:
121       - git:
122           url: '$ZUUL_URL/$ZUUL_PROJECT'
123           refspec: '{refspec}'
124           branches:
125             - '{commit}'
126           skip-tag: true
127           wipe-workspace: true
128
129 ###### WRAPPERS
130 - wrapper:
131     name: build-timeout
132     wrappers:
133         - timeout:
134             type: absolute
135             timeout: 360
136             fail: true
137
138 - wrapper:
139     # This wrapper is used for all jobs that require no-activity timeouts
140     name: fdio-infra-wrappers-non-activity-timeout
141     wrappers:
142       - timeout:
143           type: no-activity
144           timeout: '{build-timeout}'
145           fail: true
146       - timestamps
147       - ssh-agent-credentials:
148           users:
149             - 'jenkins-gerrit-credentials'
150       - jclouds:
151           single-use: True
152       - openstack:
153           single-use: True
154
155 - wrapper:
156     # This wrapper is required for all jobs as it configures the wrappers
157     # needed by the fd.io infra.
158     name: fdio-infra-wrappers
159     wrappers:
160       - timeout:
161           type: absolute
162           timeout: '{build-timeout}'
163           timeout-var: 'BUILD_TIMEOUT'
164           fail: true
165       - timestamps
166       - ssh-agent-credentials:
167           users:
168               - 'jenkins-gerrit-credentials'
169       - jclouds:
170           single-use: True
171       - openstack:
172           single-use: True
173
174 ###### TRIGGERS
175 - trigger:
176     name: gerrit-trigger-patch-submitted
177     triggers:
178         - gerrit:
179             server-name: 'Primary'
180             trigger-on:
181                 - patchset-created-event:
182                     exclude-drafts: 'true'
183                     exclude-trivial-rebase: 'false'
184                     exclude-no-code-change: 'false'
185                 - draft-published-event
186                 - comment-added-contains-event:
187                     comment-contains-value: 'recheck'
188                 - comment-added-contains-event:
189                     comment-contains-value: 'reverify'
190             projects:
191                 - project-compare-type: 'ANT'
192                   project-pattern: '{name}'
193                   branches:
194                     - branch-compare-type: 'ANT'
195                       branch-pattern: '**/{branch}'
196
197 - trigger:
198     name: gerrit-trigger-trivial-patch-submitted
199     triggers:
200         - gerrit:
201             server-name: 'Primary'
202             trigger-on:
203                 - patchset-created-event:
204                     exclude-drafts: 'true'
205                     exclude-trivial-rebase: 'false'
206                     exclude-no-code-change: 'true'
207                 - draft-published-event
208                 - comment-added-contains-event:
209                     comment-contains-value: 'recheck'
210                 - comment-added-contains-event:
211                     comment-contains-value: 'reverify'
212             projects:
213                 - project-compare-type: 'ANT'
214                   project-pattern: '{name}'
215                   branches:
216                     - branch-compare-type: 'ANT'
217                       branch-pattern: '**/{branch}'
218
219 - trigger:
220     name: gerrit-trigger-os-trivial-patch-submitted
221     triggers:
222         - gerrit:
223             server-name: 'Primary'
224             trigger-on:
225                 - comment-added-contains-event:
226                     comment-contains-value: 'os-check'
227                 - comment-added-contains-event:
228                     comment-contains-value: 'os-verify'
229             projects:
230                 - project-compare-type: 'ANT'
231                   project-pattern: '{name}'
232                   branches:
233                     - branch-compare-type: 'ANT'
234                       branch-pattern: '**/{branch}'
235
236 - trigger:
237     name: gerrit-trigger-trivial-patch-submitted-skip-vote
238     triggers:
239         - gerrit:
240             server-name: 'Primary'
241             trigger-on:
242                 - patchset-created-event:
243                     exclude-drafts: 'true'
244                     exclude-trivial-rebase: 'false'
245                     exclude-no-code-change: 'true'
246                 - draft-published-event
247                 - comment-added-contains-event:
248                     comment-contains-value: 'recheck'
249                 - comment-added-contains-event:
250                     comment-contains-value: 'reverify'
251             projects:
252                 - project-compare-type: 'ANT'
253                   project-pattern: '{name}'
254                   branches:
255                     - branch-compare-type: 'ANT'
256                       branch-pattern: '**/{branch}'
257             skip-vote:
258                 successful: true
259                 failed: true
260                 unstable: true
261                 notbuilt: true
262
263 - trigger:
264     name: gerrit-trigger-manually-triggered
265     triggers:
266         - gerrit:
267             server-name: 'Primary'
268             trigger-on:
269                 - comment-added-contains-event:
270                     comment-contains-value: '{comment-trigger-value}'
271             projects:
272                 - project-compare-type: 'ANT'
273                   project-pattern: '{name}'
274                   branches:
275                     - branch-compare-type: 'ANT'
276                       branch-pattern: '**/{branch}'
277
278 - trigger:
279     name: gerrit-trigger-patch-merged
280     triggers:
281         - gerrit:
282             server-name: 'Primary'
283             trigger-on:
284                 - change-merged-event
285                 - comment-added-contains-event:
286                     comment-contains-value: 'remerge'
287             projects:
288                 - project-compare-type: 'ANT'
289                   project-pattern: '{name}'
290                   branches:
291                     - branch-compare-type: 'ANT'
292                       branch-pattern: '**/{branch}'
293             # Force Jenkins always vote the values it should already have voted
294             # during the prior verify phase
295             override-votes: true
296             gerrit-build-started-verified-value: 1
297             gerrit-build-successful-verified-value: 1
298             gerrit-build-failed-verified-value: 1
299             gerrit-build-unstable-verified-value: 1
300             gerrit-build-notbuilt-verified-value: 1
301             gerrit-build-started-codereview-value: 0
302             gerrit-build-successful-codereview-value: 0
303             gerrit-build-failed-codereview-value: 0
304             gerrit-build-unstable-codereview-value: 0
305             gerrit-build-notbuilt-codereview-value: 0
306
307 - trigger:
308     name: gerrit-trigger-os-patch-merged
309     triggers:
310         - gerrit:
311             server-name: 'Primary'
312             trigger-on:
313                 - comment-added-contains-event:
314                     comment-contains-value: 'os-merge'
315             projects:
316                 - project-compare-type: 'ANT'
317                   project-pattern: '{name}'
318                   branches:
319                     - branch-compare-type: 'ANT'
320                       branch-pattern: '**/{branch}'
321             # Force Jenkins always vote the values it should already have voted
322             # during the prior verify phase
323             override-votes: true
324             gerrit-build-started-verified-value: 1
325             gerrit-build-successful-verified-value: 1
326             gerrit-build-failed-verified-value: 1
327             gerrit-build-unstable-verified-value: 1
328             gerrit-build-notbuilt-verified-value: 1
329             gerrit-build-started-codereview-value: 0
330             gerrit-build-successful-codereview-value: 0
331             gerrit-build-failed-codereview-value: 0
332             gerrit-build-unstable-codereview-value: 0
333             gerrit-build-notbuilt-codereview-value: 0
334
335 # Publishers
336 - publisher:
337     name: archive-artifacts
338     publishers:
339         - archive:
340             artifacts: '{artifacts}'
341             allow-empty: true
342             fingerprint: true
343             latest-only: true
344
345 - publisher:
346     name: email-notification
347     publishers:
348         - email-ext:
349             recipients: 'nobody@projectrotterdam.info'
350             reply-to: ''
351             content-type: default
352             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
353             body: |
354                 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
355
356                 Check console output at $BUILD_URL to view the results.
357             unstable: true
358             fixed: true
359             send-to:
360                 - developers
361                 - recipients
362
363 - publisher:
364     name: jacoco-report
365     publishers:
366         - jacoco:
367             exec-pattern: '**/**.exec'
368             class-pattern: '**/classes'
369             source-pattern: '**/src/main/java'
370             exclusion-pattern: '**/gen**,**/generated-sources/**,**/yang-gen**,**/pax/**'
371             status-update: true
372             targets:
373                 - branch:
374                     healthy: 10
375                     unhealthy: 20
376                 - method:
377                     healthy: 50
378                     unhealthy: 40
379
380 - publisher:
381     name: robot-report
382     publishers:
383         - robot:
384             output-path: '{output-path}'
385             other-files: ''
386
387 - publisher:
388     name: fdio-infra-shiplogs
389     # To archive things, the job will need to create an "archives" directory in
390     # the workspace and this macro will handle copying the contents of the
391     # archives directory.
392     #
393     # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files to
394     # archive. You can pass globstar patterns for example "**/*.xml **/*.log" as
395     # the archive pattern. This is a space separated list of files to archive.
396     #
397     # Also ensure that the workspace is cleaned up at the end of the build.
398     publishers:
399       - postbuildscript:
400           builders:
401             - shell: !include-raw: include-raw-deploy-archives.sh
402             - maven-target:
403                 maven-version: '{maven-version}'
404                 pom: '.archives/deploy-archives.xml'
405                 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
406                 settings: 'jenkins-log-archives-settings'
407                 settings-type: cfp
408                 global-settings: 'global-settings'
409                 global-settings-type: cfp
410             - description-setter:
411                 regexp: '^Build logs: .*'
412           script-only-if-succeeded: false
413           script-only-if-failed: false
414           mark-unstable-if-failed: true
415       - workspace-cleanup:
416           fail-build: false
417
418 - publisher:
419     name: retry-build-on-builder-error
420     publishers:
421       - naginator:
422           max-failed-builds: 1
423
424 ###### BUILDERS
425 - builder:
426     name: ci-management-check-unicode
427     builders:
428         - shell: |
429             $WORKSPACE/scripts/check-unicode.sh jjb/
430
431 - builder:
432     name: provide-maven-settings
433     builders:
434         - config-file-provider:
435             files:
436                 - file-id: '{global-settings-file}'
437                   variable: 'GLOBAL_SETTINGS_FILE'
438                 - file-id: '{settings-file}'
439                   variable: 'SETTINGS_FILE'
440
441 - property:
442     name: fdio-infra-properties
443     properties:
444         - build-discarder:
445             days-to-keep: '{build-days-to-keep}'
446             num-to-keep: '{build-num-to-keep}'
447
448
449 - builder:
450     name: packer-validate
451     builders:
452         - config-file-provider:
453             files:
454                 - file-id: 'packer-cloud-env'
455                   variable: 'CLOUDENV'
456         - shell: |
457             #!/bin/bash
458             cd packer
459             varfiles="../packer/vars/*"
460             templates="../packer/templates/*"
461             provision="../packer/provision/*.sh"
462             for v in $varfiles; do
463                 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
464                 for t in $templates; do
465                     export PACKER_LOG="yes" && \
466                     export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
467                                 packer.io validate -var-file=$CLOUDENV \
468                                 -var-file=$v $t
469                     if [ $? -ne 0 ]; then
470                         break
471                     fi
472                 done
473             done
474             for p in $provision; do
475                 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
476                 if [ $? -ne 0 ]; then
477                     break
478                 fi
479             done
480
481
482 - builder:
483     name: packer-build
484     builders:
485         - config-file-provider:
486             files:
487                 - file-id: 'packer-cloud-env'
488                   variable: 'CLOUDENV'
489         - shell: |
490             #!/bin/bash
491             cd packer
492             export PACKER_LOG="yes" && \
493             export PACKER_LOG_PATH="packer-build.log" && \
494                         packer.io build -var-file=$CLOUDENV \
495                          -var-file=../packer/vars/{platform}.json \
496                          ../packer/templates/{template}.json