Force Jenkins to not change it's votes for merge
[releng/builder.git] / jjb / releng-macros.yaml
1 # OLD Releng macros
2
3 - parameter:
4     name: opendaylight-infra-parameters
5     parameters:
6         - string:
7             name: PROJECT
8             default: '{project}'
9             description: 'Parameter to identify an ODL Gerrit project'
10         - string:
11             name: ARCHIVE_ARTIFACTS
12             default: '{artifacts} **/target/surefire-reports/*-output.txt'
13             description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
14         - string:
15             name: GERRIT_PROJECT
16             default: '{project}'
17             description: "GERRIT_PROJECT parameter if not given by trigger"
18         - string:
19             name: GERRIT_BRANCH
20             default: '{branch}'
21             description: "JJB configured GERRIT_BRANCH parameter"
22         - string:
23             name: GERRIT_REFSPEC
24             default: '{refspec}'
25             description: "GERRIT_REFSPEC parameter if not given by trigger"
26
27 - parameter:
28     name: build-tag
29     parameters:
30         - string:
31             name: BUILD_TAG
32             default: ''
33             description: 'Tag in Git to checkout'
34
35 - parameter:
36     name: controller-version-parameter
37     parameters:
38         - string:
39             name: ODL_VERSION
40             default: '{odl_version}'
41             description: 'Controller version (for use with openstacks networking_odl project)'
42
43 - parameter:
44     name: patches-to-build-parameter
45     parameters:
46         - string:
47             name: PATCHES_TO_BUILD
48             default: ''
49             description: 'csv list of patches in project:changeset format to build distribution with'
50
51 - parameter:
52     name: distribution-branch-to-build-parameter
53     parameters:
54         - string:
55             name: DISTRIBUTION_BRANCH_TO_BUILD
56             default: 'master'
57             description: 'distribution repo branch to build with'
58
59 - parameter:
60     name: p2zip-parameter
61     parameters:
62         - string:
63             name: P2ZIP_URL
64             default: ''
65             description: 'Nexus staging profile id'
66
67 - parameter:
68     name: stage-id-parameter
69     parameters:
70         - string:
71             name: STAGING_PROFILE_ID
72             default: '{stage-id}'
73             description: 'Nexus staging profile id'
74
75 - parameter:
76     name: maven-exec
77     parameters:
78       - string:
79           name: MVN
80           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
81           description: 'Maven selector to be used by shell scripts'
82
83 - scm:
84     name: git-scm
85     scm:
86         - git:
87             credentials-id: 'opendaylight-jenkins-ssh'
88             url: '$GIT_BASE'
89             refspec: ''
90             branches:
91                 - 'origin/{branch}'
92             skip-tag: true
93             wipe-workspace: true
94
95 - scm:
96     name: git-scm-with-submodules
97     scm:
98         - git:
99             credentials-id: 'opendaylight-jenkins-ssh'
100             url: '$GIT_BASE'
101             refspec: ''
102             branches:
103                 - 'refs/heads/{branch}'
104             skip-tag: true
105             wipe-workspace: true
106             submodule:
107                 recursive: true
108
109 - scm:
110     name: gerrit-trigger-scm
111     scm:
112         - git:
113             credentials-id: 'opendaylight-jenkins-ssh'
114             url: '$GIT_BASE'
115             refspec: '{refspec}'
116             branches:
117                 - 'origin/$GERRIT_BRANCH'
118             skip-tag: true
119             choosing-strategy: '{choosing-strategy}'
120
121 - wrapper:
122     name: build-timeout
123     wrappers:
124         - timeout:
125             type: absolute
126             timeout: 360
127             fail: true
128
129 - trigger:
130     name: gerrit-trigger-patch-submitted
131     triggers:
132         - gerrit:
133             server-name: 'OpenDaylight'
134             trigger-on:
135                 - patchset-created-event:
136                     exclude-drafts: 'false'
137                     exclude-trivial-rebase: 'false'
138                     exclude-no-code-change: 'false'
139                 - draft-published-event
140                 - comment-added-contains-event:
141                     comment-contains-value: 'recheck'
142                 - comment-added-contains-event:
143                     comment-contains-value: 'reverify'
144             projects:
145               - project-compare-type: 'ANT'
146                 project-pattern: '{name}'
147                 branches:
148                   - branch-compare-type: 'ANT'
149                     branch-pattern: '**/{branch}'
150
151 - trigger:
152     name: gerrit-trigger-relevant-patch-submitted
153     triggers:
154         - gerrit:
155             server-name: 'OpenDaylight'
156             trigger-on:
157                 - patchset-created-event:
158                     exclude-drafts: 'true'
159                     exclude-trivial-rebase: 'false'
160                     exclude-no-code-change: 'true'
161                 - draft-published-event
162                 - comment-added-contains-event:
163                     comment-contains-value: 'recheck'
164                 - comment-added-contains-event:
165                     comment-contains-value: 'reverify'
166             projects:
167               - project-compare-type: 'ANT'
168                 project-pattern: '{name}'
169                 branches:
170                   - branch-compare-type: 'ANT'
171                     branch-pattern: '**/{branch}'
172
173 - trigger:
174     name: gerrit-trigger-patch-merged
175     triggers:
176         - gerrit:
177             server-name: 'OpenDaylight'
178             trigger-on:
179                 - change-merged-event
180                 - comment-added-contains-event:
181                     comment-contains-value: 'remerge'
182             projects:
183               - project-compare-type: 'ANT'
184                 project-pattern: '{name}'
185                 branches:
186                   - branch-compare-type: 'ANT'
187                     branch-pattern: '**/{branch}'
188             skip-vote:
189                 successful: true
190                 failed: true
191                 unstable: true
192                 notbuilt: true
193             # Force Jenkins always vote the values it should already have voted
194             # during the prior verify phase
195             override-votes: true
196             gerrit-build-started-verified-value: 1
197             gerrit-build-successful-verified-value: 1
198             gerrit-build-failed-verified-value: 1
199             gerrit-build-unstable-verified-value: 1
200             gerrit-build-notbuilt-verified-value: 1
201             gerrit-build-started-codereview-value: 0
202             gerrit-build-successful-codereview-value: 0
203             gerrit-build-failed-codereview-value: 0
204             gerrit-build-unstable-codereview-value: 0
205             gerrit-build-notbuilt-codereview-value: 0
206
207 - trigger:
208     name: gerrit-trigger-patch-sonar
209     triggers:
210         - gerrit:
211             server-name: 'OpenDaylight'
212             trigger-on:
213                 - comment-added-contains-event:
214                     comment-contains-value: 'run-sonar'
215             projects:
216               - project-compare-type: 'ANT'
217                 project-pattern: '{name}'
218                 branches:
219                   - branch-compare-type: 'ANT'
220                     branch-pattern: '**/master'
221             skip-vote:
222                 successful: true
223                 failed: true
224                 unstable: true
225                 notbuilt: true
226
227 - trigger:
228     name: gerrit-trigger-patch-site-merged
229     triggers:
230         - gerrit:
231             server-name: 'OpenDaylight'
232             trigger-on:
233                 - change-merged-event
234                 - comment-added-contains-event:
235                     comment-contains-value: 'republish'
236             projects:
237               - project-compare-type: 'ANT'
238                 project-pattern: '{name}'
239                 branches:
240                     - branch-compare-type: 'ANT'
241                       branch-pattern: '**/{branch}'
242             # Force Jenkins always vote the values it should already have voted
243             # during the prior verify phase
244             override-votes: true
245             gerrit-build-started-verified-value: 1
246             gerrit-build-successful-verified-value: 1
247             gerrit-build-failed-verified-value: 1
248             gerrit-build-unstable-verified-value: 1
249             gerrit-build-notbuilt-verified-value: 1
250             gerrit-build-started-codereview-value: 0
251             gerrit-build-successful-codereview-value: 0
252             gerrit-build-failed-codereview-value: 0
253             gerrit-build-unstable-codereview-value: 0
254             gerrit-build-notbuilt-codereview-value: 0
255
256 - publisher:
257     name: archive-artifacts
258     publishers:
259         - archive:
260             artifacts: '{artifacts}'
261             allow-empty: true
262             fingerprint: true
263             latest-only: true
264
265 - publisher:
266     name: email-notification
267     publishers:
268         - email-ext:
269             recipients: 'jenkins@lists.opendaylight.org'
270             reply-to: ''
271             content-type: default
272             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
273             body: |
274                 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
275
276                 Check console output at $BUILD_URL to view the results.
277             unstable: true
278             fixed: true
279             send-to:
280                 - recipients
281
282 - publisher:
283         name: jacoco-report
284         publishers:
285             - jacoco:
286                 exec-pattern: "**/**.exec"
287                 class-pattern: "**/classes"
288                 source-pattern: "**/src/main/java"
289                 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
290                 status-update: true
291                 targets:
292                   - branch:
293                       healthy: 10
294                       unhealthy: 20
295                   - method:
296                       healthy: 50
297                       unhealthy: 40
298
299 - publisher:
300     name: opendaylight-infra-shiplogs
301     # To archive things the job will need to create a "archives" directory in
302     # the workspace and this macro will handle copying the contents of the
303     # archives directory.
304     #
305     # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
306     # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
307     # as the archive pattern. This is a space separated list of files to archive.
308     #
309     # Also ensure that the workspace is cleaned up at the end of the build.
310     publishers:
311         - postbuildscript:
312             builders:
313                 - shell: !include-raw: include-raw-deploy-archives.sh
314                 - maven-target:
315                         maven-version: '{maven-version}'
316                         pom: '.archives/deploy-archives.xml'
317                         goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
318                         settings: 'jenkins-log-archives-settings'
319                         settings-type: cfp
320                         global-settings: 'odl-global-settings'
321                         global-settings-type: cfp
322                 - description-setter:
323                     regexp: '^Build logs: .*'
324                 # Cleanup after ourselves
325                 - wipe-org-opendaylight-repo
326             script-only-if-succeeded: False
327             script-only-if-failed: False
328             mark-unstable-if-failed: True
329         - workspace-cleanup:
330             exclude:
331               # Do not clean up *.jenkins-trigger files for jobs that use a
332               # properties file as input for triggering another build.
333               - '**/*.jenkins-trigger'
334             fail-build: false
335
336 - builder:
337     name: wipe-org-opendaylight-repo
338     builders:
339         - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
340
341 - builder:
342     name: wipe-local-maven-repo
343     builders:
344         - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
345
346 - builder:
347     name: jacoco-nojava-workaround
348     builders:
349         - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
350
351 - builder:
352     name: check-clm
353     builders:
354         - sonatype-clm:
355             application-name: '{application-name}'
356
357 - builder:
358     name: releng-check-unicode
359     builders:
360         - shell: |
361             $WORKSPACE/scripts/check-unicode.sh jjb/
362
363 - builder:
364     name: provide-maven-settings
365     builders:
366     - config-file-provider:
367         files:
368         - file-id: '{global-settings-file}'
369           variable: 'GLOBAL_SETTINGS_FILE'
370         - file-id: '{settings-file}'
371           variable: 'SETTINGS_FILE'
372
373 - builder:
374     name: releng-fetch-p2zip-if-necessary
375     builders:
376     - shell: |
377         # Cleanup any existing zips and metadata before we download the new update site
378         rm -f *.zip *.xml
379     - conditional-step:
380         condition-kind: strings-match
381         condition-string1: '$P2ZIP_URL'
382         condition-string2: ''
383         condition-basedir: workspace
384         steps:
385             # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
386             - maven-target:
387                 maven-version: '{maven-version}'
388                 goals: 'org.apache.maven.plugins:maven-dependency-plugin:get org.apache.maven.plugins:maven-dependency-plugin:copy -V -B -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip -DoutputDirectory=$WORKSPACE'
389                 settings: '{settings}'
390                 global-settings: '{global-settings}'
391
392 - builder:
393     name: releng-generate-p2pom
394     builders:
395         - shell: !include-raw: include-raw-generate-p2pom.sh
396
397 - builder:
398     name: releng-update-p2composite-metadata
399     builders:
400     - shell: !include-raw: include-raw-update-p2composite-metadata.sh
401     - conditional-step:
402         condition-kind: file-exists
403         condition-filename: deploy-composite-repo.xml
404         condition-basedir: workspace
405         steps:
406             - maven-target:
407                 maven-version: '{maven-version}'
408                 pom: 'deploy-composite-repo.xml'
409                 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
410                 settings: '{settings}'
411                 global-settings: '{global-settings}'
412
413 - builder:
414     name: releng-stage-release
415     builders:
416         - shell: !include-raw: include-raw-stage-release.sh
417
418 - wrapper:
419     # This wrapper is required for all jobs as it configures the wrappers
420     # needed by OpenDaylight infra.
421     name: opendaylight-infra-wrappers
422     wrappers:
423         - timeout:
424             type: absolute
425             timeout: '{build-timeout}'
426             timeout-var: 'BUILD_TIMEOUT'
427             fail: true
428         - timestamps
429         - ssh-agent-credentials:
430             users:
431                 - 'opendaylight-jenkins-ssh'
432         - jclouds:
433             single-use: True
434         - openstack:
435             single-use: True
436
437 - builder:
438     name: packer-validate
439     builders:
440         - config-file-provider:
441             files:
442                 - file-id: 'packer-cloud-env'
443                   variable: 'CLOUDENV'
444         - shell: |
445             cd packer
446             export PACKER_LOG="yes" && \
447             export PACKER_LOG_PATH="packer-validate.log" && \
448                         packer.io validate -var-file=$CLOUDENV \
449                          -var-file=../packer/vars/{platform}.json \
450                          ../packer/templates/{template}.json
451
452 - builder:
453     name: packer-build
454     builders:
455         - shell: |
456             cd packer
457             export PACKER_LOG="yes" && \
458             export PACKER_LOG_PATH="packer-build.log" && \
459                         packer.io build -var-file=$CLOUDENV \
460                          -var-file=../packer/vars/{platform}.json \
461                          ../packer/templates/{template}.json