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