Merge "copy ssh keys in csit-1node-verify job"
[releng/builder.git] / jjb / releng-macros.yaml
1 # OLD Releng macros
2
3 - parameter:
4     name: project-parameter
5     parameters:
6         - string:
7             name: PROJECT
8             default: '{project}'
9             description: "JJB configured PROJECT parameter to identify an ODL Gerrit project"
10
11 - parameter:
12     name: gerrit-parameters
13     parameters:
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 - scm:
76     name: git-scm
77     scm:
78         - git:
79             credentials-id: 'opendaylight-jenkins-ssh'
80             url: '$GIT_BASE'
81             refspec: ''
82             branches:
83                 - 'origin/{branch}'
84             skip-tag: true
85             wipe-workspace: true
86
87 - scm:
88     name: git-scm-with-submodules
89     scm:
90         - git:
91             credentials-id: 'opendaylight-jenkins-ssh'
92             url: '$GIT_BASE'
93             refspec: ''
94             branches:
95                 - 'refs/heads/{branch}'
96             skip-tag: true
97             wipe-workspace: true
98             submodule:
99                 recursive: true
100
101 - scm:
102     name: gerrit-trigger-scm
103     scm:
104         - git:
105             credentials-id: 'opendaylight-jenkins-ssh'
106             url: '$GIT_BASE'
107             refspec: '{refspec}'
108             branches:
109                 - 'origin/$GERRIT_BRANCH'
110             skip-tag: true
111             choosing-strategy: '{choosing-strategy}'
112
113 - wrapper:
114     name: build-timeout
115     wrappers:
116         - timeout:
117             type: absolute
118             timeout: 360
119             fail: true
120
121 - trigger:
122     name: gerrit-trigger-patch-submitted
123     triggers:
124         - gerrit:
125             server-name: 'OpenDaylight'
126             trigger-on:
127                 - patchset-created-event:
128                     exclude-drafts: 'false'
129                     exclude-trivial-rebase: 'false'
130                     exclude-no-code-change: 'false'
131                 - draft-published-event
132                 - comment-added-contains-event:
133                     comment-contains-value: 'recheck'
134                 - comment-added-contains-event:
135                     comment-contains-value: 'reverify'
136             projects:
137               - project-compare-type: 'ANT'
138                 project-pattern: '{name}'
139                 branches:
140                   - branch-compare-type: 'ANT'
141                     branch-pattern: '**/{branch}'
142
143 - trigger:
144     name: gerrit-trigger-relevant-patch-submitted
145     triggers:
146         - gerrit:
147             server-name: 'OpenDaylight'
148             trigger-on:
149                 - patchset-created-event:
150                     exclude-drafts: 'true'
151                     exclude-trivial-rebase: 'false'
152                     exclude-no-code-change: 'true'
153                 - draft-published-event
154                 - comment-added-contains-event:
155                     comment-contains-value: 'recheck'
156                 - comment-added-contains-event:
157                     comment-contains-value: 'reverify'
158             projects:
159               - project-compare-type: 'ANT'
160                 project-pattern: '{name}'
161                 branches:
162                   - branch-compare-type: 'ANT'
163                     branch-pattern: '**/{branch}'
164
165 - trigger:
166     name: gerrit-trigger-patch-merged
167     triggers:
168         - gerrit:
169             server-name: 'OpenDaylight'
170             trigger-on:
171                 - change-merged-event
172                 - comment-added-contains-event:
173                     comment-contains-value: 'remerge'
174             projects:
175               - project-compare-type: 'ANT'
176                 project-pattern: '{name}'
177                 branches:
178                   - branch-compare-type: 'ANT'
179                     branch-pattern: '**/{branch}'
180
181 - trigger:
182     name: gerrit-trigger-patch-sonar
183     triggers:
184         - gerrit:
185             server-name: 'OpenDaylight'
186             trigger-on:
187                 - comment-added-contains-event:
188                     comment-contains-value: 'run-sonar'
189             projects:
190               - project-compare-type: 'ANT'
191                 project-pattern: '{name}'
192                 branches:
193                   - branch-compare-type: 'ANT'
194                     branch-pattern: '**/master'
195             skip-vote:
196                 successful: true
197                 failed: true
198                 unstable: true
199                 notbuilt: true
200
201 - trigger:
202     name: gerrit-trigger-patch-site-merged
203     triggers:
204         - gerrit:
205             server-name: 'OpenDaylight'
206             trigger-on:
207                 - change-merged-event
208                 - comment-added-contains-event:
209                     comment-contains-value: 'republish'
210             projects:
211               - project-compare-type: 'ANT'
212                 project-pattern: '{name}'
213                 branches:
214                     - branch-compare-type: 'ANT'
215                       branch-pattern: '**/{branch}'
216
217 - publisher:
218     name: archive-artifacts
219     publishers:
220         - archive:
221             artifacts: '{artifacts}'
222             allow-empty: true
223             fingerprint: true
224             latest-only: true
225
226 - publisher:
227     name: email-notification
228     publishers:
229         - email-ext:
230             recipients: 'jenkins@lists.opendaylight.org'
231             reply-to:
232             content-type: default
233             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
234             body: |
235                 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
236
237                 Check console output at $BUILD_URL to view the results.
238             unstable: true
239             fixed: true
240             send-to:
241                 - recipients
242
243 - publisher:
244         name: jacoco-report
245         publishers:
246             - jacoco:
247                 exec-pattern: "**/**.exec"
248                 class-pattern: "**/classes"
249                 source-pattern: "**/src/main/java"
250                 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
251                 status-update: true
252                 targets:
253                   - branch:
254                       healthy: 10
255                       unhealthy: 20
256                   - method:
257                       healthy: 50
258                       unhealthy: 40
259
260 - publisher:
261     name: archive-build
262     # To archive things the job will need to create a "archives" directory in
263     # the workspace and this macro will handle copying the contents of the
264     # archives directory.
265     # Also ensure that the workspace is cleaned up at the end of the build.
266     publishers:
267         - postbuildscript:
268             builders:
269                 - shell: !include-raw: include-raw-deploy-archives.sh
270                 - maven-target:
271                         maven-version: '{maven-version}'
272                         pom: '.archives/deploy-archives.xml'
273                         goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
274                         settings: 'jenkins-log-archives-settings'
275                         settings-type: cfp
276                         global-settings: 'odl-global-settings'
277                         global-settings-type: cfp
278                 - description-setter:
279                     regexp: '^Build logs: .*'
280                 # Cleanup after ourselves
281                 - wipe-org-opendaylight-repo
282             script-only-if-succeeded: False
283             script-only-if-failed: False
284             mark-unstable-if-failed: True
285         - workspace-cleanup:
286             fail-build: false
287
288 - builder:
289     name: wipe-org-opendaylight-repo
290     builders:
291         - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
292
293 - builder:
294     name: wipe-local-maven-repo
295     builders:
296         - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
297
298 - builder:
299     name: jacoco-nojava-workaround
300     builders:
301         - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
302
303 - builder:
304     name: check-clm
305     builders:
306         - sonatype-clm:
307             application-name: '{application-name}'
308
309 - builder:
310     name: releng-check-unicode
311     builders:
312         - shell: |
313             $WORKSPACE/scripts/check-unicode.sh jjb/
314
315 - builder:
316     name: provide-maven-settings
317     builders:
318     - config-file-provider:
319         files:
320         - file-id: '{global-settings-file}'
321           variable: 'GLOBAL_SETTINGS_FILE'
322         - file-id: '{settings-file}'
323           variable: 'SETTINGS_FILE'
324
325 - builder:
326     name: releng-fetch-p2zip-if-necessary
327     builders:
328     - shell: |
329         # Cleanup any existing zips and metadata before we download the new update site
330         rm -f *.zip *.xml
331     - conditional-step:
332         condition-kind: strings-match
333         condition-string1: '$P2ZIP_URL'
334         condition-string2: ''
335         condition-basedir: workspace
336         steps:
337             # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
338             - maven-target:
339                 maven-version: '{maven-version}'
340                 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'
341                 settings: '{settings}'
342                 global-settings: '{global-settings}'
343
344 - builder:
345     name: releng-generate-p2pom
346     builders:
347         - shell: !include-raw: include-raw-generate-p2pom.sh
348
349 - builder:
350     name: releng-update-p2composite-metadata
351     builders:
352     - shell: !include-raw: include-raw-update-p2composite-metadata.sh
353     - conditional-step:
354         condition-kind: file-exists
355         condition-filename: deploy-composite-repo.xml
356         condition-basedir: workspace
357         steps:
358             - maven-target:
359                 maven-version: '{maven-version}'
360                 pom: 'deploy-composite-repo.xml'
361                 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
362                 settings: '{settings}'
363                 global-settings: '{global-settings}'
364
365 - builder:
366     name: releng-stage-release
367     builders:
368         - shell: !include-raw: include-raw-stage-release.sh
369
370 - wrapper:
371     # This wrapper is required for all jobs as it configures the wrappers
372     # needed by OpenDaylight infra.
373     name: opendaylight-infra-wrappers
374     wrappers:
375         - timeout:
376             type: absolute
377             timeout: '{build-timeout}'
378             timeout-var: 'BUILD_TIMEOUT'
379             fail: true
380         - ssh-agent-credentials:
381             users:
382                 - 'opendaylight-jenkins-ssh'
383         - openstack:
384             single-use: True