Merge "Improvements to distribution verify/merge jobs"
[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: '{credentials-id}'
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: '{credentials-id}'
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: '{credentials-id}'
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                 - developers
242                 - recipients
243
244 - publisher:
245         name: jacoco-report
246         publishers:
247             - jacoco:
248                 exec-pattern: "**/**.exec"
249                 class-pattern: "**/classes"
250                 source-pattern: "**/src/main/java"
251                 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
252                 status-update: true
253                 targets:
254                   - branch:
255                       healthy: 10
256                       unhealthy: 20
257                   - method:
258                       healthy: 50
259                       unhealthy: 40
260
261 - builder:
262     name: wipe-org-opendaylight-repo
263     builders:
264         - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
265
266 - builder:
267     name: wipe-local-maven-repo
268     builders:
269         - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
270
271 - builder:
272     name: jacoco-nojava-workaround
273     builders:
274         - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
275
276 - builder:
277     name: check-clm
278     builders:
279         - sonatype-clm:
280             application-name: '{application-name}'
281
282 - builder:
283     name: releng-check-unicode
284     builders:
285         - shell: |
286             $WORKSPACE/scripts/check-unicode.sh jjb/
287
288 - builder:
289     name: provide-maven-settings
290     builders:
291     - config-file-provider:
292         files:
293         - file-id: '{global-settings-file}'
294           variable: 'GLOBAL_SETTINGS_FILE'
295         - file-id: '{settings-file}'
296           variable: 'SETTINGS_FILE'
297
298 - builder:
299     name: releng-fetch-p2zip-if-necessary
300     builders:
301     - shell: |
302         # Cleanup any existing zips and metadata before we download the new update site
303         rm -f *.zip *.xml
304     - conditional-step:
305         condition-kind: strings-match
306         condition-string1: '$P2ZIP_URL'
307         condition-string2: ''
308         condition-basedir: workspace
309         steps:
310             # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
311             - maven-target:
312                 maven-version: '{maven-version}'
313                 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'
314                 settings: '{settings}'
315                 global-settings: '{global-settings}'
316
317 - builder:
318     name: releng-generate-p2pom
319     builders:
320         - shell: !include-raw: include-raw-generate-p2pom.sh
321
322 - builder:
323     name: releng-update-p2composite-metadata
324     builders:
325     - shell: !include-raw: include-raw-update-p2composite-metadata.sh
326     - conditional-step:
327         condition-kind: file-exists
328         condition-filename: deploy-composite-repo.xml
329         condition-basedir: workspace
330         steps:
331             - maven-target:
332                 maven-version: '{maven-version}'
333                 pom: 'deploy-composite-repo.xml'
334                 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
335                 settings: '{settings}'
336                 global-settings: '{global-settings}'
337
338 - builder:
339     name: releng-stage-release
340     builders:
341         - shell: !include-raw: include-raw-stage-release.sh