Chore: Automation adds usecase-ui-llm-adaptation.yaml
[ci-management.git] / jjb / global-macros.yaml
1 ---
2 # Global macros
3
4 # vim: sw=2 ts=2 sts=2 et :
5
6 # BUILDERS
7 - builder:
8     name: provide-maven-settings
9     builders:
10       - config-file-provider:
11           files:
12             - file-id: "{global-settings-file}"
13               variable: "GLOBAL_SETTINGS_FILE"
14             - file-id: "{settings-file}"
15               variable: "SETTINGS_FILE"
16
17 # call maven-target builder with a goal of --version to force Jenkins to
18 # install the needed maven version
19 - builder:
20     name: maven-install
21     builders:
22       - maven-target:
23           maven-version: "{maven-version}"
24           goals: "--version"
25
26 - builder:
27     name: maven-set-release-version
28     builders:
29       - maven-target:
30           maven-version: "{maven-version}"
31           pom: "{pom}"
32           goals: "versions:set versions:update-child-modules versions:commit -B"
33           properties:
34             - "newVersion=${{release_version}}"
35           settings: "{mvn-settings}"
36           settings-type: cfp
37           global-settings: "global-settings"
38           global-settings-type: cfp
39
40 - builder:
41     name: maven-docker-push-release
42     builders:
43       - maven-target:
44           maven-version: "{maven-version}"
45           pom: "{pom}"
46           goals: "clean deploy -B -P {mvn-profile}"
47           settings: "{mvn-settings}"
48           settings-type: cfp
49           global-settings: "global-settings"
50           global-settings-type: cfp
51           properties:
52             - maven.test.skip=true
53             - docker.pull.registry=nexus3.onap.org:10001
54             - docker.push.registry=nexus3.onap.org:10002
55
56 - builder:
57     name: maven-docker-push-daily
58     builders:
59       - maven-target:
60           maven-version: "{maven-version}"
61           pom: "{pom}"
62           goals: "clean deploy -B -P {mvn-profile} {mvn-params}"
63           settings: "{mvn-settings}"
64           settings-type: cfp
65           global-settings: "global-settings"
66           global-settings-type: cfp
67           properties:
68             - docker.pull.registry=nexus3.onap.org:10001
69             - docker.push.registry=nexus3.onap.org:10003
70
71 - builder:
72     name: docker-login
73     builders:
74       - shell: !include-raw: include-docker-login.sh
75
76 - builder:
77     name: publish-pypi
78     builders:
79       - inject:
80           properties-content: PYPI_SERVER={pypi-server}
81       - shell: !include-raw-escape: ../shell/pypi-publish.sh
82
83 # PARAMETERS
84 - parameter:
85     name: infra-parameters
86     parameters:
87       - string:
88           name: PROJECT
89           default: "{project}"
90           # yamllint disable rule:line-length
91           description: "JJB configured PROJECT parameter to identify a Gerrit project"
92           # yamllint enable
93       - string:
94           name: ARCHIVE_ARTIFACTS
95           default: "{artifacts} **/target/surefire-reports/*-output.txt"
96           # yamllint disable rule:line-length
97           description: "Space separated glob patterns for artifacts to archive to logs hosting"
98           # yamllint enable
99       - string:
100           name: GERRIT_BRANCH
101           default: "{branch}"
102           description: "JJB configured GERRIT_BRANCH parameter"
103       - string:
104           name: GERRIT_PROJECT
105           default: "{project}"
106           description: "GERRIT_PROJECT parameter if not given by trigger"
107       - string:
108           name: GERRIT_REFSPEC
109           default: "{refspec}"
110           description: "GERRIT_REFSPEC parameter if not given by trigger"
111       - string:
112           name: STACK_NAME
113           default: "$JOB_NAME-$BUILD_NUMBER"
114           description: "Used by Heat to generate a unique stack & vm name"
115
116 - parameter:
117     name: maven-params
118     parameters:
119       - string:
120           name: MAVEN_PARAMS
121           default: "{mvn-params}"
122           description: Maven parameters to pass to the mvn command.
123
124 - parameter:
125     name: maven-exec
126     parameters:
127       - string:
128           name: MVN
129           # yamllint disable rule:line-length
130           default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn"
131           # yamllint enable
132           description: "Maven selector to be used by shell scripts"
133
134 - parameter:
135     name: docker-image-name
136     parameters:
137       - string:
138           name: DOCKER_IMAGE_NAME
139           # yamllint disable rule:line-length
140           default: "{docker-image-name}"
141           # yamllint enable
142           description: "Docker image name, e.g. onap/appc"
143
144 # PROPERTIES
145 - property:
146     name: infra-properties
147     properties:
148       - build-discarder:
149           days-to-keep: "{build-days-to-keep}"
150           num-to-keep: 40
151           artifact-days-to-keep: -1
152           artifact-num-to-keep: 5
153
154 # PUBLISHERS
155 - publisher:
156     name: archive-artifacts
157     publishers:
158       - archive:
159           artifacts: "{artifacts}"
160           allow-empty: true
161           fingerprint: true
162           latest-only: true
163
164 - publisher:
165     name: email-notification
166     publishers:
167       - email-ext:
168           recipients: "nobody@open-o.org"
169           reply-to:
170           content-type: default
171           # yamllint disable rule:line-length
172           subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
173           # yamllint enable
174           body: |
175             $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
176
177             Check console output at $BUILD_URL to view the results.
178           unstable: true
179           fixed: true
180           send-to:
181             - developers
182             - recipients
183
184 - publisher:
185     name: jacoco-report
186     publishers:
187       - jacoco:
188           exec-pattern: "**/**.exec"
189           class-pattern: "**/classes"
190           source-pattern: "**/src/main/java"
191           # yamllint disable rule:line-length
192           exclusion-pattern: "**/gen**,**/generated-sources/**,**/yang-gen**,**/pax/**"
193           # yamllint enable
194           status-update: true
195           targets:
196             - branch:
197                 healthy: 10
198                 unhealthy: 20
199             - method:
200                 healthy: 50
201                 unhealthy: 40
202
203 - publisher:
204     name: checkstyle-result
205     publishers:
206       - checkstyle:
207           pattern: "**/checkstyle-result.xml"
208           healthy: 0
209           unhealthy: 100
210           health-threshold: "high"
211           thresholds:
212             unstable:
213               total-all: 30
214               total-high: 15
215               total-normal: 20
216               total-low: 25
217               new-all: 5
218               new-high: 0
219               new-normal: 2
220               new-low: 5
221
222 - publisher:
223     name: checkstyle-result-daily
224     publishers:
225       - checkstyle:
226           pattern: "**/checkstyle-result.xml"
227           healthy: 0
228           unhealthy: 100
229           health-threshold: "high"
230           thresholds:
231             unstable:
232               total-all: 30
233               total-high: 15
234               total-normal: 20
235               total-low: 25
236               new-all: 1
237               new-high: 0
238               new-normal: 1
239               new-low: 1
240
241 # SCMS
242 - scm:
243     name: git-scm
244     scm:
245       - git:
246           credentials-id: "onap-jenkins-ssh"
247           url: "$GIT_BASE"
248           refspec: ""
249           branches:
250             - "origin/{branch}"
251           skip-tag: true
252           wipe-workspace: true
253           timeout: 30
254
255 - scm:
256     name: gerrit-trigger-scm
257     scm:
258       - git:
259           credentials-id: "onap-jenkins-ssh"
260           url: "$GIT_BASE"
261           refspec: "{refspec}"
262           branches:
263             - "origin/$GERRIT_BRANCH"
264           skip-tag: true
265           timeout: 30
266           choosing-strategy: "{choosing-strategy}"
267           submodule:
268             recursive: "{submodule-recursive}"
269
270 - scm:
271     name: gerrit-trigger-scm-basedir
272     scm:
273       - git:
274           credentials-id: "onap-jenkins-ssh"
275           url: "$GIT_BASE"
276           refspec: "{refspec}"
277           branches:
278             - "origin/$GERRIT_BRANCH"
279           skip-tag: true
280           timeout: 30
281           choosing-strategy: "{choosing-strategy}"
282           basedir: "{basedir}"
283
284 - scm:
285     name: git-branch-scm
286     scm:
287       - git:
288           credentials-id: "onap-jenkins-ssh"
289           url: "$GIT_BASE"
290           refspec: ""
291           branches:
292             - "origin/{branch}"
293           skip-tag: true
294           timeout: 30
295           wipe-workspace: true
296
297 - scm:
298     name: git-extra-project
299     scm:
300       - git:
301           credentials-id: "onap-jenkins-ssh"
302           url: "$GIT_NO_PROJECT/{project}"
303           refspec: "{refspec}"
304           branches:
305             - "origin/{branch}"
306           skip-tag: true
307           timeoute: 30
308           wipe-workspace: false
309           basedir: "{checkout-dir}"
310
311 # TRIGGERS
312
313 # This is a single macro to use for all jobs who vote on every (relevant) patch
314 # set. Only 'recheck' trigger word is supported, it always triggers the full set
315 # of relevant jobs, in order to prevent Jenkins from starting only a subset and
316 # still voting Verified+1
317 # Arguments:
318 #     server: name of gerrit server to listen to
319 #     project: pattern to match triggering projects
320 #     branch: triggering branch name
321 #     files: pattern to match triggering filepaths
322 - trigger:
323     name: gerrit-trigger-patch-submitted
324     triggers:
325       - gerrit:
326           server-name: "{server}"
327           trigger-on:
328             - patchset-created-event:
329                 exclude-drafts: "false"
330                 exclude-trivial-rebase: "false"
331                 exclude-no-code-change: "false"
332             - draft-published-event
333             - comment-added-contains-event:
334                 comment-contains-value: "recheck"
335           projects:
336             - project-compare-type: "ANT"
337               project-pattern: "{project}"
338               branches:
339                 - branch-compare-type: "ANT"
340                   branch-pattern: "**/{branch}"
341               file-paths:
342                 - compare-type: "ANT"
343                   pattern: "{files}"
344
345 - trigger:
346     name: gerrit-trigger-patch-merged
347     triggers:
348       - gerrit:
349           server-name: "{server}"
350           trigger-on:
351             - change-merged-event
352             - comment-added-contains-event:
353                 comment-contains-value: "remerge"
354           projects:
355             - project-compare-type: "ANT"
356               project-pattern: "{project}"
357               branches:
358                 - branch-compare-type: "ANT"
359                   branch-pattern: "**/{branch}"
360               file-paths:
361                 - compare-type: "ANT"
362                   pattern: "{files}"
363
364 - trigger:
365     name: gerrit-trigger-helm-patch-submitted
366     triggers:
367       - gerrit:
368           server-name: "{server}"
369           trigger-on:
370             - patchset-created-event:
371                 exclude-drafts: "false"
372                 exclude-no-code-change: "false"
373                 exclude-trivial-rebase: "false"
374                 exclude-wip: "true"
375             - draft-published-event
376             - comment-added-contains-event:
377                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify|verify-helm)\s*$'
378           projects:
379             - project-compare-type: "ANT"
380               project-pattern: "{project}"
381               branches:
382                 - branch-compare-type: "ANT"
383                   branch-pattern: "**/{branch}"
384               file-paths:
385                 - compare-type: "ANT"
386                   pattern: "{files}"
387
388 - trigger:
389     name: gerrit-trigger-helm-patch-merged
390     triggers:
391       - gerrit:
392           server-name: "{server}"
393           trigger-on:
394             - change-merged-event
395             - comment-added-contains-event:
396                 comment-contains-value: "^remerge-helm$"
397           projects:
398             - project-compare-type: "ANT"
399               project-pattern: "{project}"
400               branches:
401                 - branch-compare-type: "ANT"
402                   branch-pattern: "**/{branch}"
403               file-paths:
404                 - compare-type: "ANT"
405                   pattern: "{files}"
406
407 - trigger:
408     name: gerrit-trigger-release-manually
409     triggers:
410       - gerrit:
411           server-name: "{server}"
412           trigger-on:
413             - comment-added-contains-event:
414                 comment-contains-value: "please release"
415           projects:
416             - project-compare-type: "ANT"
417               project-pattern: "{project}"
418               branches:
419                 - branch-compare-type: "ANT"
420                   branch-pattern: "**/{branch}"
421               file-paths:
422                 - compare-type: "ANT"
423                   pattern: "**"
424
425 - trigger:
426     name: trigger-on-build-success
427     triggers:
428       - reverse:
429           jobs: "{job-name}"
430           result: "success"
431
432 # WRAPPERS
433 - wrapper:
434     name: build-timeout
435     wrappers:
436       - timeout:
437           type: absolute
438           timeout: 360
439           fail: true
440
441 - wrapper:
442     name: golang110
443     wrappers:
444       - raw:
445           xml: |
446             <org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="golang@1.2">
447             <goVersion>Golang 1.10</goVersion>
448             </org.jenkinsci.plugins.golang.GolangBuildWrapper>
449
450 - wrapper:
451     name: golang111
452     wrappers:
453       - raw:
454           xml: |
455             <org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="golang@1.2">
456             <goVersion>Golang 1.11</goVersion>
457             </org.jenkinsci.plugins.golang.GolangBuildWrapper>
458
459 - wrapper:
460     name: golang112
461     wrappers:
462       - raw:
463           xml: |
464             <org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="golang@1.2">
465             <goVersion>Golang 1.12</goVersion>
466             </org.jenkinsci.plugins.golang.GolangBuildWrapper>
467
468 - wrapper:
469     name: golang114
470     wrappers:
471       - raw:
472           xml: |
473             <org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="golang@1.2">
474             <goVersion>Golang 1.14</goVersion>
475             </org.jenkinsci.plugins.golang.GolangBuildWrapper>
476
477 - wrapper:
478     # This wrapper is required for all jobs as it configures the wrappers
479     # needed by the eCOMP infra.
480     name: infra-wrappers
481     wrappers:
482       - timestamps
483       - timeout:
484           type: absolute
485           timeout: "{build-timeout}"
486           timeout-var: "BUILD_TIMEOUT"
487           fail: true
488       - ssh-agent-credentials:
489           users:
490             - "onap-jenkins-ssh"
491       - openstack:
492           single-use: true
493
494 - wrapper:
495     # This wrapper is used for docker build jobs to use the dedicated docker
496     # build VM and turn off OpenStack single-use
497     name: infra-wrappers-docker-build
498     wrappers:
499       - timestamps
500       - timeout:
501           type: absolute
502           timeout: "{build-timeout}"
503           timeout-var: "BUILD_TIMEOUT"
504           fail: true
505       - ssh-agent-credentials:
506           users:
507             - "onap-jenkins-ssh"
508       - openstack:
509           single-use: false