ea0e367df1dbe8aa87d42c0e9e25b09fe918142c
[ci-management.git] / jjb / global-macros.yaml
1 # Copyright (c) 2021 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 ---
15 # Global macros.
16
17 #### PARAMETERS
18 # Keep 'parameter' entries ordered alphabetically, please.
19 - parameter:
20     name: arch-parameter
21     parameters:
22       - string:
23           name: ARCH
24           default: '{arch}'
25           description: "Architecture parameter"
26
27 - parameter:
28     name: archive-artifacts-parameter
29     parameters:
30       - string:
31           name: ARCHIVE_ARTIFACTS
32           default: '{artifacts}'
33           description: "Artifacts to archive on the log server."
34
35 - parameter:
36     name: compiler-parameter
37     parameters:
38       - string:
39           name: CC
40           default: '{cc}'
41           description: "CC parameter, can be gnu or clang"
42
43 - parameter:
44     name: make-parallel-jobs-parameter
45     parameters:
46       - string:
47           name: MAKE_PARALLEL_JOBS
48           default: '{make-parallel-jobs}'
49           description: "The number of cores to use for builds."
50
51 - parameter:
52     name: make-test-os-parameter
53     parameters:
54       - string:
55           name: MAKE_TEST_OS
56           default: '{make-test-os}'
57           description: "The OS on which 'make test' is run."
58
59 - parameter:
60     name: csit-fail-on-crc-mismatch-parameter
61     parameters:
62       - string:
63           name: FDIO_CSIT_FAIL_ON_CRC_MISMATCH
64           default: '{fail-on-crc-mismatch}'
65           description: "If true, CRC is checked, else compatibility is tested."
66
67 - parameter:
68     name: csit-perf-trial-duration-parameter
69     parameters:
70       - string:
71           name: CSIT_PERF_TRIAL_DURATION
72           default: "{csit-perf-trial-duration}"
73           description: "Duration of a trial measurement in BMRR tests."
74
75 - parameter:
76     name: csit-perf-trial-multiplicity-parameter
77     parameters:
78       - string:
79           name: CSIT_PERF_TRIAL_MULTIPLICITY
80           default: "{csit-perf-trial-multiplicity}"
81           description: "Number of subsamples for BMRR tests."
82
83 - parameter:
84     name: gerrit-csit-refspec-parameter
85     parameters:
86       - string:
87           name: CSIT_REF
88           default: ''
89           # yamllint disable-line rule:line-length
90           description: "GERRIT_REFSPEC parameter to override separately cloned CSIT repository, leave empty for autodetection / no override."
91
92 - parameter:
93     name: gerrit-event-comment-text-parameter
94     parameters:
95       - string:
96           name: GERRIT_EVENT_COMMENT_TEXT
97           default: ''
98           # yamllint disable-line rule:line-length
99           description: "GERRIT_EVENT_COMMENT_TEXT parameter not given by trigger"
100
101 - parameter:
102     name: gerrit-event-type-parameter
103     parameters:
104       - string:
105           name: GERRIT_EVENT_TYPE
106           default: ''
107           description: "GERRIT_EVENT_TYPE parameter not given by trigger"
108
109 - parameter:
110     name: gerrit-parameter
111     parameters:
112       - string:
113           name: GERRIT_BRANCH
114           default: '{branch}'
115           description: "JJB configured GERRIT_BRANCH parameter"
116
117 - parameter:
118     name: gerrit-project-parameter
119     parameters:
120       - string:
121           name: GERRIT_PROJECT
122           default: '{project}'
123           description: "GERRIT_PROJECT parameter if not given by trigger"
124
125 - parameter:
126     name: gerrit-refspec-parameter
127     parameters:
128       - string:
129           name: GERRIT_REFSPEC
130           default: '{refspec}'
131           description: "GERRIT_REFSPEC parameter not given by trigger"
132
133 - parameter:
134     name: is-csit-vpp-job-parameter
135     parameters:
136       - string:
137           name: IS_CSIT_VPP_JOB
138           default: '{is-csit-vpp-job}'
139           description: "Parameter is True if this is a CSIT vpp job."
140
141 - parameter:
142     name: maven-exec
143     parameters:
144       - string:
145           name: MVN
146           # yamllint disable-line rule:line-length
147           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
148           description: 'Maven selector to be used by shell scripts'
149
150 - parameter:
151     name: maven-project-parameter
152     parameters:
153       - string:
154           name: MAVEN_SELECTOR
155           default: '{maven}'
156           description: 'Maven selector to be used by shell scripts'
157
158 - parameter:
159     name: mode-parameter
160     parameters:
161       - string:
162           name: MODE
163           default: '{mode}'
164           description: "mode parameter to be used in shell scripts."
165
166 - parameter:
167     name: os-parameter
168     parameters:
169       - string:
170           name: OS
171           default: '{os}'
172           description: "OS parameter"
173
174 - parameter:
175     name: project-parameter
176     parameters:
177       - string:
178           name: PROJECT
179           default: '{project}'
180           # yamllint disable-line rule:line-length
181           description: "JJB configured PROJECT parameter to identify a Gerrit project"
182
183 - parameter:
184     name: repo-name-parameter
185     parameters:
186       - string:
187           name: REPO_NAME
188           default: '{repo-name}'
189           description: 'Name of repo to which to publish packaging'
190
191 - parameter:
192     name: stream-parameter
193     parameters:
194       - string:
195           name: STREAM
196           default: '{stream}'
197           description: "Stream job parameter to be used in shell scripts."
198
199 - parameter:
200     name: topo-parameter
201     parameters:
202       - string:
203           name: TOPO
204           default: '{topo}'
205           description: "Topology parameter"
206 # [end] Keep 'parameter' entries ordered alphabetically, please.
207
208 #### SCMS
209 # Keep 'scm' entries ordered alphabetically, please.
210 - scm:
211     name: gerrit-trigger-scm
212     scm:
213       - git:
214           credentials-id: '{credentials-id}'
215           url: '$GIT_BASE'
216           refspec: '{refspec}'
217           branches:
218             - 'origin/$GERRIT_BRANCH'
219           skip-tag: true
220           choosing-strategy: '{choosing-strategy}'
221
222 - scm:
223     name: gerrit-trigger-scm-recursive
224     scm:
225       - git:
226           credentials-id: '{credentials-id}'
227           url: '$GIT_BASE'
228           refspec: '{refspec}'
229           branches:
230             - 'origin/$GERRIT_BRANCH'
231           skip-tag: true
232           choosing-strategy: '{choosing-strategy}'
233           submodule:
234             recursive: '{submodule-recursive}'
235
236 - scm:
237     name: git-scm
238     scm:
239       - git:
240           credentials-id: '{credentials-id}'
241           url: '$GIT_BASE'
242           refspec: ''
243           branches:
244             - 'origin/{branch}'
245           skip-tag: true
246           wipe-workspace: true
247 # [end] Keep 'scm' entries ordered alphabetically, please.
248
249 #### WRAPPERS
250 # Keep 'wrapper' entries ordered alphabetically, please.
251 - wrapper:
252     name: build-timeout
253     wrappers:
254       - timeout:
255           type: absolute
256           timeout: 360
257           fail: true
258
259 - wrapper:
260     # This wrapper is required for all jobs as it configures the wrappers
261     # needed by the fd.io infra.
262     name: fdio-infra-wrappers
263     wrappers:
264       - timeout:
265           type: absolute
266           timeout: '{build-timeout}'
267           timeout-var: 'BUILD_TIMEOUT'
268           fail: true
269       - timestamps
270       - ssh-agent-credentials:
271           users:
272             - 'jenkins-gerrit-credentials'
273       - jclouds:
274           single-use: true
275       - openstack:
276           single-use: true
277
278 - wrapper:
279     # This wrapper is used for all jobs that require no-activity timeouts
280     name: fdio-infra-wrappers-non-activity-timeout
281     wrappers:
282       - timeout:
283           type: no-activity
284           timeout: '{build-timeout}'
285           fail: true
286       - timestamps
287       - ssh-agent-credentials:
288           users:
289             - 'jenkins-gerrit-credentials'
290       - jclouds:
291           single-use: true
292       - openstack:
293           single-use: true
294 # [end] Keep 'wrapper' entries ordered alphabetically, please.
295
296 #### TRIGGERS
297 # Keep 'trigger' entries ordered alphabetically, please.
298 - trigger:
299     name: gerrit-trigger-checkstyle
300     # Comes from VPP, some verify jobs wait for checkstyle to pass.
301     # This macro is to be used for such verify jobs which are voting.
302     triggers:
303       - gerrit:
304           server-name: 'Primary'
305           trigger-on:
306             - comment-added-contains-event:
307                 comment-contains-value: 'checkstyle_success'
308           projects:
309             - project-compare-type: 'ANT'
310               project-pattern: '{name}'
311               branches:
312                 - branch-compare-type: 'ANT'
313                   branch-pattern: '**/{branch}'
314
315 - trigger:
316     name: gerrit-trigger-checkstyle-nonvoting
317     # Comes from VPP, some verify jobs wait for checkstyle to pass.
318     # This macro is to be used for such verify jobs which are non-voting.
319     triggers:
320       - gerrit:
321           server-name: 'Primary'
322           trigger-on:
323             - comment-added-contains-event:
324                 comment-contains-value: 'checkstyle_success'
325           projects:
326             - project-compare-type: 'ANT'
327               project-pattern: '{name}'
328               branches:
329                 - branch-compare-type: 'ANT'
330                   branch-pattern: '**/{branch}'
331           skip-vote:
332             successful: true
333             failed: true
334             unstable: true
335             notbuilt: true
336           override-votes: true
337           gerrit-build-successful-verified-value: 1
338           gerrit-build-failed-verified-value: 1
339           gerrit-build-unstable-verified-value: 1
340           gerrit-build-notbuilt-verified-value: 1
341
342 - trigger:
343     name: gerrit-trigger-csit-perftest
344     # Manual trigger common for csit-vpp and vpp-csit perf jobs.
345     triggers:
346       - gerrit:
347           server-name: 'Primary'
348           trigger-on:
349             - comment-added-contains-event:
350                 comment-contains-value: '{trigger-word}'
351           projects:
352             - project-compare-type: 'ANT'
353               project-pattern: '{project}'
354               branches:
355                 - branch-compare-type: 'ANT'
356                   branch-pattern: '**/{branch}'
357           skip-vote:
358             successful: '{skip-vote}'
359             failed: '{skip-vote}'
360             unstable: '{skip-vote}'
361             notbuilt: '{skip-vote}'
362
363 - trigger:
364     name: gerrit-trigger-csit-vpp-devicetest-full
365     # Comes from CSIT, for automatic jobs running device tests with VPP builds.
366     # The job acts as an automatic verify job for CSIT contributions.
367     triggers:
368       - gerrit:
369           server-name: 'Primary'
370           trigger-on:
371             # The main way the job is triggered automatically on patch upload.
372             # Gated by tox job, so we do not spend resources on WiP changes.
373             - comment-added-contains-event:
374                 comment-contains-value: 'tox_success'
375             # Manual trigger to allow testing WiP changes with selected tags.
376             - comment-added-contains-event:
377                 comment-contains-value: 'csit-devicetest'
378             # A comment with "recheck" restarts tox job, so no condition here.
379           projects:
380             - project-compare-type: 'ANT'
381               project-pattern: '{project}'
382               branches:
383                 - branch-compare-type: 'ANT'
384                   branch-pattern: '**/{branch}'
385           skip-vote:
386             successful: '{skip-vote}'
387             failed: '{skip-vote}'
388             unstable: '{skip-vote}'
389             notbuilt: '{skip-vote}'
390
391 - trigger:
392     name: gerrit-trigger-csit-vpp-devicetest-manual
393     # Comes from CSIT, for manual jobs running "device" tests with VPP builds.
394     # The job acts as a manual (optional) verify job for CSIT contributions.
395     triggers:
396       - gerrit:
397           server-name: 'Primary'
398           trigger-on:
399             - comment-added-contains-event:
400                 comment-contains-value: 'csit-devicetest'
401           projects:
402             - project-compare-type: 'ANT'
403               project-pattern: '{project}'
404               branches:
405                 - branch-compare-type: 'ANT'
406                   branch-pattern: '**/{branch}'
407           skip-vote:
408             successful: '{skip-vote}'
409             failed: '{skip-vote}'
410             unstable: '{skip-vote}'
411             notbuilt: '{skip-vote}'
412
413 - trigger:
414     name: gerrit-trigger-manually-triggered
415     triggers:
416       - gerrit:
417           server-name: 'Primary'
418           trigger-on:
419             - comment-added-contains-event:
420                 comment-contains-value: '{comment-trigger-value}'
421           projects:
422             - project-compare-type: 'ANT'
423               project-pattern: '{name}'
424               branches:
425                 - branch-compare-type: 'ANT'
426                   branch-pattern: '**/{branch}'
427
428 - trigger:
429     name: gerrit-trigger-patch-merged
430     triggers:
431       - gerrit:
432           server-name: 'Primary'
433           trigger-on:
434             - change-merged-event
435             - comment-added-contains-event:
436                 comment-contains-value: 'remerge'
437           projects:
438             - project-compare-type: 'ANT'
439               project-pattern: '{name}'
440               branches:
441                 - branch-compare-type: 'ANT'
442                   branch-pattern: '**/{branch}'
443           # Force Jenkins always vote the values it should already have voted
444           # during the prior verify phase
445           override-votes: true
446           gerrit-build-started-verified-value: 1
447           gerrit-build-successful-verified-value: 1
448           gerrit-build-failed-verified-value: 1
449           gerrit-build-unstable-verified-value: 1
450           gerrit-build-notbuilt-verified-value: 1
451           gerrit-build-started-codereview-value: 0
452           gerrit-build-successful-codereview-value: 0
453           gerrit-build-failed-codereview-value: 0
454           gerrit-build-unstable-codereview-value: 0
455           gerrit-build-notbuilt-codereview-value: 0
456
457 - trigger:
458     name: gerrit-trigger-patch-submitted
459     triggers:
460       - gerrit:
461           server-name: 'Primary'
462           trigger-on:
463             - patchset-created-event:
464                 exclude-drafts: 'true'
465                 exclude-trivial-rebase: 'false'
466                 exclude-no-code-change: 'false'
467             - draft-published-event
468             - comment-added-contains-event:
469                 comment-contains-value: 'recheck'
470             - comment-added-contains-event:
471                 comment-contains-value: 'reverify'
472           projects:
473             - project-compare-type: 'ANT'
474               project-pattern: '{name}'
475               branches:
476                 - branch-compare-type: 'ANT'
477                   branch-pattern: '**/{branch}'
478
479 - trigger:
480     name: gerrit-trigger-os-patch-merged
481     triggers:
482       - gerrit:
483           server-name: 'Primary'
484           trigger-on:
485             - comment-added-contains-event:
486                 comment-contains-value: 'os-merge'
487           projects:
488             - project-compare-type: 'ANT'
489               project-pattern: '{name}'
490               branches:
491                 - branch-compare-type: 'ANT'
492                   branch-pattern: '**/{branch}'
493           # Force Jenkins always vote the values it should already have voted
494           # during the prior verify phase
495           override-votes: true
496           gerrit-build-started-verified-value: 1
497           gerrit-build-successful-verified-value: 1
498           gerrit-build-failed-verified-value: 1
499           gerrit-build-unstable-verified-value: 1
500           gerrit-build-notbuilt-verified-value: 1
501           gerrit-build-started-codereview-value: 0
502           gerrit-build-successful-codereview-value: 0
503           gerrit-build-failed-codereview-value: 0
504           gerrit-build-unstable-codereview-value: 0
505           gerrit-build-notbuilt-codereview-value: 0
506
507 - trigger:
508     name: gerrit-trigger-os-trivial-patch-submitted
509     triggers:
510       - gerrit:
511           server-name: 'Primary'
512           trigger-on:
513             - comment-added-contains-event:
514                 comment-contains-value: 'os-check'
515             - comment-added-contains-event:
516                 comment-contains-value: 'os-verify'
517           projects:
518             - project-compare-type: 'ANT'
519               project-pattern: '{name}'
520               branches:
521                 - branch-compare-type: 'ANT'
522                   branch-pattern: '**/{branch}'
523
524 - trigger:
525     name: gerrit-trigger-trivial-patch-submitted
526     triggers:
527       - gerrit:
528           server-name: 'Primary'
529           trigger-on:
530             - patchset-created-event:
531                 exclude-drafts: 'true'
532                 exclude-trivial-rebase: 'false'
533                 exclude-no-code-change: 'true'
534             - draft-published-event
535             - comment-added-contains-event:
536                 comment-contains-value: 'recheck'
537             - comment-added-contains-event:
538                 comment-contains-value: 'reverify'
539           projects:
540             - project-compare-type: 'ANT'
541               project-pattern: '{name}'
542               branches:
543                 - branch-compare-type: 'ANT'
544                   branch-pattern: '**/{branch}'
545
546 - trigger:
547     name: gerrit-trigger-trivial-patch-submitted-skip-vote
548     triggers:
549       - gerrit:
550           server-name: 'Primary'
551           trigger-on:
552             - patchset-created-event:
553                 exclude-drafts: 'true'
554                 exclude-trivial-rebase: 'false'
555                 exclude-no-code-change: 'true'
556             - draft-published-event
557             - comment-added-contains-event:
558                 comment-contains-value: 'recheck'
559             - comment-added-contains-event:
560                 comment-contains-value: 'reverify'
561           projects:
562             - project-compare-type: 'ANT'
563               project-pattern: '{name}'
564               branches:
565                 - branch-compare-type: 'ANT'
566                   branch-pattern: '**/{branch}'
567           skip-vote:
568             successful: true
569             failed: true
570             unstable: true
571             notbuilt: true
572
573 - trigger:
574     name: gerrit-trigger-vpp-csit-devicetest-full
575     # Comes from VPP, for automated jobs running "device" tests with CSIT code.
576     # The job acts as an automatic verify job for VPP contributions.
577     triggers:
578       - gerrit:
579           server-name: 'Primary'
580           trigger-on:
581             - comment-added-contains-event:
582                 comment-contains-value: 'checkstyle_success'
583             - comment-added-contains-event:
584                 comment-contains-value: 'devicetest'
585           projects:
586             - project-compare-type: 'ANT'
587               project-pattern: '{name}'
588               branches:
589                 - branch-compare-type: 'ANT'
590                   branch-pattern: '**/{branch}'
591           skip-vote:
592             successful: '{skip-vote}'
593             failed: '{skip-vote}'
594             unstable: '{skip-vote}'
595             notbuilt: '{skip-vote}'
596
597 - trigger:
598     name: gerrit-trigger-vpp-csit-devicetest-manual
599     # Comes from VPP, for manual jobs running "device" tests with CSIT code.
600     # The job acts as a manual (optional) verify job for VPP contributions.
601     triggers:
602       - gerrit:
603           server-name: 'Primary'
604           trigger-on:
605             - comment-added-contains-event:
606                 comment-contains-value: 'devicetest'
607           projects:
608             - project-compare-type: 'ANT'
609               project-pattern: '{name}'
610               branches:
611                 - branch-compare-type: 'ANT'
612                   branch-pattern: '**/{branch}'
613           skip-vote:
614             successful: '{skip-vote}'
615             failed: '{skip-vote}'
616             unstable: '{skip-vote}'
617             notbuilt: '{skip-vote}'
618 # [end] Keep 'trigger' entries ordered alphabetically, please.
619
620 #### PUBLISHERS
621 # Keep 'publisher' entries ordered alphabetically, please.
622 - publisher:
623     name: archive-artifacts
624     publishers:
625       - archive:
626           artifacts: '{artifacts}'
627           allow-empty: true
628           fingerprint: true
629           latest-only: true
630
631 - publisher:
632     name: csit-trending-failed
633     publishers:
634       - email-ext:
635           # yamllint disable-line rule:line-length
636           recipients: 'tifrank@cisco.com, csit-report+int+616+181919729795594561@lists.fd.io'
637           reply-to: ''
638           content-type: 'text'
639           subject: '{branch}: Failed tests as of $BUILD_TIMESTAMP'
640           # yamllint disable-line rule:line-length
641           body: |
642               Following tests failed in the last trending job runs, listed per testbed type.
643
644               ${{FILE,path="resources/tools/presentation/_build/_static/vpp/trending-failed-tests.txt"}}
645           failure: false
646           success: true
647
648 - publisher:
649     name: csit-trending-failed-job
650     publishers:
651       - email-ext:
652           # yamllint disable-line rule:line-length
653           recipients: 'tifrank@cisco.com, csit-report+int+616+181919729795594561@lists.fd.io'
654           reply-to: ''
655           content-type: 'text'
656           subject: '{branch}: The build number $BUILD_NUMBER of the job $JOB_NAME failed'
657           # yamllint disable-line rule:line-length
658           body: |
659               For more information see $BUILD_URL.
660           failure: true
661           success: false
662
663 - publisher:
664     name: csit-trending-progressions
665     publishers:
666       - email-ext:
667           # yamllint disable-line rule:line-length
668           recipients: 'tifrank@cisco.com, csit-report+int+616+181919729795594561@lists.fd.io'
669           reply-to: ''
670           content-type: 'text'
671           subject: '{branch}: Progressions as of $BUILD_TIMESTAMP'
672           # yamllint disable-line rule:line-length
673           body: |
674               Following progressions occured in the last trending job runs, listed per testbed type.
675
676               ${{FILE,path="resources/tools/presentation/_build/_static/vpp/trending-progressions.txt"}}
677           failure: false
678           success: true
679
680 - publisher:
681     name: csit-trending-regressions
682     publishers:
683       - email-ext:
684           # yamllint disable-line rule:line-length
685           recipients: 'tifrank@cisco.com, csit-report+int+616+181919729795594561@lists.fd.io'
686           reply-to: ''
687           content-type: 'text'
688           subject: '{branch}: Regressions as of $BUILD_TIMESTAMP'
689           # yamllint disable-line rule:line-length
690           body: |
691               Following regressions occured in the last trending job runs, listed per testbed type.
692
693               ${{FILE,path="resources/tools/presentation/_build/_static/vpp/trending-regressions.txt"}}
694           failure: false
695           success: true
696
697 - publisher:
698     name: email-notification
699     publishers:
700       - email-ext:
701           recipients: 'nobody@projectrotterdam.info'
702           reply-to: ''
703           content-type: default
704           # yamllint disable-line rule:line-length
705           subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
706           body: |
707               $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
708
709               Check console output at $BUILD_URL to view the results.
710           unstable: true
711           fixed: true
712           send-to:
713             - developers
714             - recipients
715
716 - publisher:
717     name: fdio-infra-publish-docs
718     # macro to finish up a build.
719     #
720     # Handles the following:
721     #   - Shipping docs S3 logs repository
722     #   - Cleanup workspace
723     publishers:
724       - postbuildscript:
725           builders:
726             - role: BOTH
727               build-on:
728                 - ABORTED
729                 - FAILURE
730                 - NOT_BUILT
731                 - SUCCESS
732                 - UNSTABLE
733               build-steps:
734                 - fdio-infra-ship-docs
735           mark-unstable-if-failed: true
736       - workspace-cleanup:
737           exclude:
738             # Do not clean up *.jenkins-trigger files for jobs that use a
739             # properties file as input for triggering another build.
740             - "**/*.jenkins-trigger"
741           fail-build: false
742
743 - publisher:
744     name: fdio-infra-publish
745     # macro to finish up a build.
746     #
747     # Handles the following:
748     #   - Shipping logs to Nexus or S3 logs repository
749     #   - Cleanup workspace
750     publishers:
751       - postbuildscript:
752           builders:
753             - role: BOTH
754               build-on:
755                 - ABORTED
756                 - FAILURE
757                 - NOT_BUILT
758                 - SUCCESS
759                 - UNSTABLE
760               build-steps:
761                 - shell: !include-raw: scripts/post_build_executor_info.sh
762                 - shell: !include-raw: scripts/post_build_deploy_archives.sh
763                 - fdio-infra-ship-backup-logs
764                 - fdio-infra-ship-logs
765           mark-unstable-if-failed: true
766       - workspace-cleanup:
767           exclude:
768             # Do not clean up *.jenkins-trigger files for jobs that use a
769             # properties file as input for triggering another build.
770             - "**/*.jenkins-trigger"
771           fail-build: false
772
773 - publisher:
774     name: jacoco-report
775     publishers:
776       - jacoco:
777           exec-pattern: '**/**.exec'
778           class-pattern: '**/classes'
779           source-pattern: '**/src/main/java'
780           # yamllint disable-line rule:line-length
781           exclusion-pattern: '**/gen**,**/generated-sources/**,**/yang-gen**,**/pax/**'
782           status-update: true
783           targets:
784             - branch:
785               healthy: 10
786               unhealthy: 20
787             - method:
788               healthy: 50
789               unhealthy: 40
790
791 - publisher:
792     name: retry-build-on-builder-error
793     publishers:
794       - naginator:
795           max-failed-builds: 1
796
797 - publisher:
798     name: robot-report
799     publishers:
800       - robot:
801           output-path: '{output-path}'
802           other-files: ''
803
804 # [end] Keep 'publisher' entries ordered alphabetically, please.
805
806 #### BUILDERS
807 # Keep 'builder' entries ordered alphabetically, please.
808 - builder:
809     name: ci-management-check-unicode
810     builders:
811       - shell: |
812           $WORKSPACE/scripts/check-unicode.sh jjb/
813
814 - builder:
815     name: fdio-infra-ship-docs
816     builders:
817       - config-file-provider:
818           files:
819             - file-id: "jenkins-log-archives-settings"
820               variable: "SETTINGS_FILE"
821       - config-file-provider:
822           files:
823             - file-id: "jenkins-s3-docs-ship"
824               target: $HOME/.aws/credentials
825       - shell: !include-raw:
826           - scripts/publish_library_py.sh
827       - shell: !include-raw:
828           - scripts/publish_docs.sh
829       - shell: !include-raw:
830           - ../global-jjb/shell/logs-clear-credentials.sh
831
832 - builder:
833     name: fdio-infra-ship-backup-logs
834     builders:
835       - config-file-provider:
836           files:
837             - file-id: "jenkins-s3-log-ship"
838               variable: $HOME/.aws/credentials
839       - shell: !include-raw:
840           - scripts/publish_library_py.sh
841       - shell: !include-raw:
842           - scripts/publish_logs.sh
843       - shell: !include-raw:
844           - ../global-jjb/shell/logs-clear-credentials.sh
845
846 - builder:
847     name: fdio-infra-ship-logs
848     builders:
849       # Ensure no pre-existing .netrc files are overriding logs config
850       - lf-provide-maven-settings-cleanup
851       - config-file-provider:
852           files:
853             - file-id: "jenkins-log-archives-settings"
854               variable: "SETTINGS_FILE"
855       - conditional-step:
856           condition-kind: regex-match
857           regex: "^.*logs-s3.*"
858           label: $S3_BUCKET
859           on-evaluation-failure: dont-run
860           steps:
861             - config-file-provider:
862                 files:
863                   - file-id: "jenkins-s3-log-ship"
864                     target: $HOME/.aws/credentials
865       - lf-infra-create-netrc:
866           server-id: logs
867       - shell: !include-raw:
868           - ../global-jjb/shell/logs-deploy.sh
869       - shell: !include-raw:
870           - ../global-jjb/shell/logs-clear-credentials.sh
871       - description-setter:
872           regexp: "(^S3 build logs: .*)"
873
874 - builder:
875     name: packer-validate
876     builders:
877       - config-file-provider:
878           files:
879             - file-id: 'packer-cloud-env'
880               variable: 'CLOUDENV'
881       # yamllint disable rule:line-length
882       - shell: |
883           #!/bin/bash
884           cd packer
885           varfiles="../packer/vars/*"
886           templates="../packer/templates/*"
887           provision="../packer/provision/*.sh"
888           for v in $varfiles; do
889               [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
890               for t in $templates; do
891                   export PACKER_LOG="yes" && \
892                   export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
893                               packer.io validate -var-file=$CLOUDENV \
894                               -var-file=$v $t
895                   if [ $? -ne 0 ]; then
896                      break
897                   fi
898               done
899           done
900           for p in $provision; do
901               /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
902               if [ $? -ne 0 ]; then
903                  break
904               fi
905           done
906       # yamllint enable
907
908 - builder:
909     name: packer-build
910     builders:
911       - config-file-provider:
912           files:
913             - file-id: 'packer-cloud-env'
914               variable: 'CLOUDENV'
915       - shell: |
916           #!/bin/bash
917           cd packer
918           export PACKER_LOG="yes" && \
919           export PACKER_LOG_PATH="packer-build.log" && \
920                       packer.io build -var-file=$CLOUDENV \
921                       -var-file=../packer/vars/{platform}.json \
922                       ../packer/templates/{template}.json
923
924 - builder:
925     name: provide-maven-settings
926     builders:
927       - config-file-provider:
928           files:
929             - file-id: '{global-settings-file}'
930               variable: 'GLOBAL_SETTINGS_FILE'
931             - file-id: '{settings-file}'
932               variable: 'SETTINGS_FILE'
933 # [end] Keep 'builder' entries ordered alphabetically, please.