Improve DRY_RUN mode to perform a build
[releng/builder.git] / jjb / autorelease / autorelease-templates.yaml
1 ---
2 # Autorelease build jobs
3 - job-template:
4     name: 'autorelease-release-{stream}'
5
6     ############
7     # Defaults #
8     ############
9
10     build-node: '{build-node}'
11     java-version: openjdk8
12     mvn-version: mvn33
13     extra-mvn-opts: ''
14
15     #####################
16     # Job Configuration #
17     #####################
18
19     project-type: freestyle
20     node: '{build-node}'
21     jdk: '{java-version}'
22     cron: 'H 0 * * *'
23
24     properties:
25       - lf-infra-properties:
26           build-days-to-keep: 30
27
28     parameters:
29       - maven-exec:
30           maven-version: 'mvn33'
31       - lf-infra-parameters:
32           project: '{project}'
33           stream: '{stream}'
34           branch: '{branch}'
35           lftools-version: '{lftools-version}'
36       - distribution-karaf-version:
37           karaf-version: '{karaf-version}'
38       - autorelease-release-tag:
39           release-tag: '{next-release-tag}'
40       - string:
41           name: EXTRA_MVN_OPTS
42           default: '{extra-mvn-opts}'
43           description: |
44               Additional optional Maven Options to pass to the Maven Goals
45               parameter.
46
47               Examples:
48               -Dskip.karaf.featureTest=true  # To disable karaf SingleFeatureTests
49               --fail-never   # NEVER fail the build, regardless of project result
50               --fail-at-end  # Only fail the build afterwards; allow all non-impacted builds to continue
51       - string:
52           name: ARCHIVE_ARTIFACTS
53           default: '{archive-artifacts}'
54           description: Artifacts to archive to the logs server.
55
56     scm:
57       - git:
58           credentials-id: 'opendaylight-jenkins-ssh'
59           url: '$GIT_BASE'
60           refspec: '$GERRIT_REFSPEC'
61           branches:
62             - '$GERRIT_BRANCH'
63           choosing-strategy: default
64           skip-tag: true
65           submodule:
66             recursive: true
67             timeout: 60
68
69     wrappers:
70       - opendaylight-infra-wrappers:
71           build-timeout: '900'
72
73     triggers:
74       - timed: '{cron}'
75
76     builders:
77       # force jenkins install of maven version before any shell scripts use it
78       - lf-maven-install:
79           mvn-version: '{mvn-version}'
80       - wipe-local-maven-repo
81       - jacoco-nojava-workaround
82       - shell: "./scripts/list-project-dependencies.sh"
83       - autorelease-determine-merge-order
84       - autorelease-cfp:
85           autorelease-settings: 'autorelease-settings'
86           global-settings: 'odl-global-settings'
87       - autorelease-generate-release-patches
88       - autorelease-generate-artifact-versions
89       - autorelease-distribute-taglist
90       - distribute-build-url:
91           path: 'integration/distribution/$KARAF_ARTIFACT/src/main/assembly'
92       # In a perfect world projects should be releasing separately and we consume them
93       # via a project that pulls the release bits from each project from Nexus.
94       # Keep the patches compatible with that ideal, but apply an edit
95       # to enable building in a single maven reactor afterwards.
96       - autorelease-fix-relative-paths
97       - maven-target:
98           maven-version: 'mvn33'
99           pom: 'pom.xml'
100           goals: |
101               clean deploy
102               $EXTRA_MVN_OPTS
103               -Pintegrationtests,docs,repoBuild
104               -Dcheckstyle.skip=true
105               -DaltDeploymentRepository=staging::default::file:hide/from/pom/files/stage
106               {opendaylight-infra-mvn-opts}
107           java-opts:
108             - '-Xmx8g -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
109           settings: 'autorelease-settings'
110           settings-type: cfp
111           global-settings: 'global-settings'
112           global-settings-type: cfp
113       - autorelease-maven-deploy
114       - autorelease-get-integration-test-variables
115       - autorelease-maven-sources:
116           opendaylight-infra-mvn-opts: '{opendaylight-infra-mvn-opts}'
117           maven-version: 'mvn33'
118           settings: 'autorelease-settings'
119           global-settings: 'global-settings'
120       - autorelease-maven-sources-post-process
121       - shell: |
122           mkdir -p archives/
123           cp *.log *.prop $_
124
125     publishers:
126       - opendaylight-infra-notify-status
127       - trigger-parameterized-builds:
128           - project: 'integration-distribution-test-{integration-test}'
129             condition: UNSTABLE_OR_BETTER
130             property-file: variables.jenkins-trigger
131             fail-on-missing: true
132           - project: 'integration-distribution-test-{integration-test}'
133             condition: FAILED
134             trigger-with-no-params: true
135           - project: 'integration-sanity-test-{integration-test}'
136             condition: UNSTABLE_OR_BETTER
137             property-file: variables.jenkins-trigger
138             fail-on-missing: true
139           - project: 'integration-sanity-test-{integration-test}'
140             condition: FAILED
141             trigger-with-no-params: true
142           - project: 'packaging-build-rpm-{stream}'
143             condition: UNSTABLE_OR_BETTER
144             predefined-parameters: DOWNLOAD_URL=$BUNDLE_URL
145             property-file: variables.jenkins-trigger
146             fail-on-missing: true
147           - project: 'packaging-build-deb-{stream}'
148             condition: UNSTABLE_OR_BETTER
149             predefined-parameters: DOWNLOAD_URL=$BUNDLE_URL
150             property-file: variables.jenkins-trigger
151             fail-on-missing: true
152       - lf-infra-publish
153
154 - job-template:
155     name: autorelease-update-validate-jobs-{stream}
156     project-type: freestyle
157     node: centos7-builder-2c-1g
158
159     properties:
160       - lf-infra-properties:
161           build-days-to-keep: 7
162
163     parameters:
164       - lf-infra-parameters:
165           project: releng/builder
166           branch: '{branch}'
167           stream: '{stream}'
168           lftools-version: '{lftools-version}'
169
170     scm:
171       - lf-infra-gerrit-scm:
172           git-url: '$GIT_URL/releng/builder'
173           branch: master
174           refspec: 'refs/heads/master'
175           jenkins-ssh-credential: opendaylight-jenkins-ssh
176           submodule-recursive: true
177           choosing-strategy: default
178
179     triggers:
180       - gerrit:
181           server-name: '{gerrit-server-name}'
182           trigger-on:
183             - change-merged-event
184             - comment-added-contains-event:
185                 comment-contains-value: remerge$
186           projects:
187             - project-compare-type: ANT
188               project-pattern: '{project}'
189               branches:
190                 - branch-compare-type: ANT
191                   branch-pattern: '**/{branch}'
192               file-paths:
193                 - compare-type: ANT
194                   pattern: pom.xml
195
196     wrappers:
197       - lf-infra-wrappers:
198           build-timeout: 10
199           jenkins-ssh-credential: opendaylight-jenkins-ssh
200
201     builders:
202       - autorelease-update-validate-projects
203       - opendaylight-infra-push-gerrit-patch:
204           project: 'releng/builder'
205           gerrit-topic: 'autorelease-update-validate-jobs-{stream}'
206           gerrit-commit-message: |
207               Update validate autorelease projects for {stream}
208
209     publishers:
210       - lf-infra-publish
211
212 - job-template:
213     name: autorelease-version-bump-{stream}
214     project-type: freestyle
215     node: '{build-node}'
216
217     properties:
218       - opendaylight-infra-properties:
219           build-days-to-keep: 7
220
221     parameters:
222       - lf-infra-parameters:
223           project: releng/autorelease
224           branch: '{branch}'
225           stream: '{stream}'
226           refspec: 'refs/heads/{branch}'
227           lftools-version: '{lftools-version}'
228       - string:
229           name: RELEASE_TAG
230           default: '{next-release-tag}'
231           description: |
232               Release that is being version bumped.
233               Eg. Lithium, Beryllium, Boron, Carbon, Carbon-SR1, Carbon-SR2...
234       - bool:
235           name: DRY_RUN
236           default: true
237           description: |
238               If DRY_RUN is enabled modifications are not published to Gerrit
239               and artifacts are not pushed to Nexus. Instead the build will be
240               performed using the goals "clean install".
241       - maven-exec:
242           maven-version: mvn33
243
244     scm:
245       - lf-infra-gerrit-scm:
246           git-url: '$GIT_URL/$GERRIT_PROJECT'
247           branch: '{branch}'
248           refspec: 'refs/heads/{branch}'
249           jenkins-ssh-credential: opendaylight-jenkins-ssh
250           submodule-recursive: true
251           choosing-strategy: default
252
253     wrappers:
254       - lf-infra-wrappers:
255           build-timeout: 480
256           jenkins-ssh-credential: opendaylight-jenkins-ssh
257
258     builders:
259       # force jenkins install of maven version before any shell scripts use it
260       - maven-target:
261           maven-version: mvn33
262           goals: '-version'
263           settings: autorelease-settings
264           settings-type: cfp
265           global-settings: global-settings
266           global-settings-type: cfp
267       - autorelease-cfp
268       - shell: !include-raw-escape:
269           - ../global-jjb/shell/lftools-install.sh
270           - version-bump.sh
271
272     publishers:
273       - lf-infra-publish
274
275 - job-template:
276     name: 'autorelease-generate-release-notes-{stream}'
277
278     ######################
279     # Default parameters #
280     ######################
281
282     gerrit_merge_triggers:
283       - comment-added-contains-event:
284           comment-contains-value: generate-release-notes .+$
285
286     #####################
287     # Job Configuration #
288     #####################
289
290     project-type: freestyle
291     node: centos7-builder-2c-8g
292
293     properties:
294       - lf-infra-properties:
295           build-days-to-keep: 7
296
297     parameters:
298       - lf-infra-parameters:
299           project: '{project}'
300           branch: '{branch}'
301           stream: '{stream}'
302           lftools-version: '{lftools-version}'
303       - string:
304           name: RELEASE
305           description: Release to generate release notes for.
306
307     scm:
308       - lf-infra-gerrit-scm:
309           git-url: '$GIT_URL/$GERRIT_PROJECT'
310           branch: '$GERRIT_BRANCH'
311           refspec: '$GERRIT_REFSPEC'
312           jenkins-ssh-credential: opendaylight-jenkins-ssh
313           submodule-recursive: true
314           choosing-strategy: default
315
316     wrappers:
317       - lf-infra-wrappers:
318           build-timeout: 10
319           jenkins-ssh-credential: opendaylight-jenkins-ssh
320
321     triggers:
322       - gerrit:
323           server-name: '{gerrit-server-name}'
324           trigger-on: '{obj:gerrit_merge_triggers}'
325           projects:
326             - project-compare-type: ANT
327               project-pattern: '{project}'
328               branches:
329                 - branch-compare-type: ANT
330                   branch-pattern: '**/{branch}'
331
332     builders:
333       - autorelease-generate-release-notes
334
335     publishers:
336       - lf-infra-publish
337
338 - job-template:
339     name: '{project-name}-validate-autorelease-{stream}'
340
341     ############
342     # Defaults #
343     ############
344
345     java-version: openjdk8
346
347     #####################
348     # Job Configuration #
349     #####################
350
351     disabled: false
352     project-type: freestyle
353     # Note: This NEEDS to be hardcoded as projects should NOT be allowed to
354     #       override the build node.
355     node: centos7-builder-2c-8g
356     concurrent: true
357     jdk: '{java-version}'
358
359     properties:
360       - lf-infra-properties:
361           build-days-to-keep: 7
362
363     parameters:
364       - lf-infra-parameters:
365           project: '{project}'
366           stream: '{stream}'
367           branch: '{branch}'
368           lftools-version: '{lftools-version}'
369       - autorelease-release-tag:
370           release-tag: validate
371       - string:
372           name: CLONE_URL
373           default: '{git-url}/releng/autorelease'
374           description: "Autorelease clone URL"
375
376     scm:
377       - git:
378           url: '$CLONE_URL'
379           credentials-id: 'opendaylight-jenkins-ssh'
380           refspec: ''
381           branches:
382             - 'origin/{branch}'
383           skip-tag: true
384           submodule:
385             recursive: true
386             timeout: 60
387
388     wrappers:
389       - opendaylight-infra-wrappers:
390           build-timeout: '{build-timeout}'
391
392     triggers:
393       - gerrit-trigger-patch-submitted:
394           gerrit-server-name: '{gerrit-server-name}'
395           project: '{project}'
396           branch: '{branch}'
397           files: '**/*.xml'
398
399     builders:
400       - autorelease-checkout-gerrit-patch
401       - jacoco-nojava-workaround
402       - shell: "./scripts/list-project-dependencies.sh"
403       - autorelease-determine-merge-order
404       - autorelease-generate-release-patches
405       # In a perfect world projects should be releasing separately and we consume them
406       # via a project that pulls the release bits from each project from Nexus.
407       # Keep the patches compatible with that ideal, but apply an edit
408       # to enable building in a single maven reactor afterwards.
409       - autorelease-fix-relative-paths
410       - maven-target:
411           maven-version: mvn33
412           pom: validate-pom.xml
413           goals: |
414               clean install dependency:tree
415               -T1.5C
416               -Pq
417               {opendaylight-infra-mvn-opts}
418           java-opts:
419             - '-Xmx8g'
420           settings: autorelease-settings
421           settings-type: cfp
422           global-settings: global-settings
423           global-settings-type: cfp
424       # Hack to workaround the duplicate-finder plugin in odlparent breaking validate-autorelease
425       - shell: sed -i 's/validate/none/' /tmp/r/org/opendaylight/odlparent/odlparent/3.0.2/odlparent-3.0.2.pom
426       - maven-target:
427           maven-version: mvn33
428           pom: pom.xml
429           goals: |
430               clean validate
431               -Pq
432               {opendaylight-infra-mvn-opts}
433           java-opts:
434             - '-Xmx8g -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
435           settings: autorelease-settings
436           settings-type: cfp
437           global-settings: global-settings
438           global-settings-type: cfp
439       - shell: |
440           mkdir -p archives/
441           cp *.log $_
442
443     publishers:
444       - email-notification:
445           email-recipients: '{email-recipients}'
446           email-prefix: '[autorelease] [{project-name}]'
447       - lf-infra-publish