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