Add job to automatically cleanup old images
[releng/builder.git] / jjb / releng-jobs.yaml
1 ---
2 - project:
3     name: builder-jobs
4     jobs:
5       - 'builder-verify-jjb'
6       - '{project-name}-verify-tox-{stream}'
7       - 'builder-merge'
8       - 'builder-weekly'
9       - 'builder-check-poms'
10       - 'builder-verify-packer'
11       - 'builder-merge-packer-{platforms}-{templates}'
12       # OpenStack Related
13       - 'builder-cleanup-old-images'
14       - 'builder-delete-stale-stacks'
15       # Automation for docs and jobs
16       - 'builder-update-csit-tests'
17       - 'builder-update-image-list'
18
19     platforms:
20       - centos
21       - ubuntu-14.04
22
23     templates:
24       - devstack
25       - devstack-pre-pip-mitaka
26       - devstack-pre-pip-newton
27       - docker
28       - gbp
29       - java-builder
30       - mininet
31       - mininet-ovs-2.3
32       - mininet-ovs-2.5
33       - robot
34
35     exclude:
36       - platforms: centos
37         templates: gbp
38       - platforms: centos
39         templates: mininet
40       - platforms: centos
41         templates: mininet-ovs-2.3
42       - platforms: centos
43         templates: mininet-ovs-2.5
44       - platforms: ubuntu-14.04
45         templates: java-builder
46       - platforms: ubuntu-14.04
47         templates: robot
48       - platforms: ubuntu-14.04
49         templates: devstack-pre-pip-mitaka
50       - platforms: ubuntu-14.04
51         templates: devstack-pre-pip-newton
52       - platforms: ubuntu-14.04
53         templates: devstack
54       - platforms: ubuntu-14.04
55         templates: docker
56
57     project-type: freestyle
58     archive-artifacts: '**/*.log'
59     build-timeout: '60'
60
61     # The following values are only specified here
62     # so that code blocks look similar to other projects.
63     project: 'releng/builder'
64     project-name: builder
65     stream: master
66     branch: master
67
68 - job-template:
69     name: builder-verify-jjb
70     node: centos7-java-builder-2c-4g
71     concurrent: true
72
73     project-type: freestyle
74
75     properties:
76       - opendaylight-infra-properties:
77           build-days-to-keep: 14
78
79     parameters:
80       - opendaylight-infra-parameters:
81           project: '{project}'
82           branch: '{branch}'
83           refspec: 'refs/heads/{branch}'
84           artifacts: '{archive-artifacts}'
85
86     scm:
87       - gerrit-trigger-scm:
88           refspec: '$GERRIT_REFSPEC'
89           choosing-strategy: 'gerrit'
90
91     wrappers:
92       - opendaylight-infra-wrappers:
93           build-timeout: '{build-timeout}'
94
95     triggers:
96       - gerrit-trigger-patch-submitted:
97           server: '{server-name}'
98           project: '{project}'
99           branch: '{branch}'
100           files: 'jjb/**'
101
102     builders:
103       - opendaylight-infra-jjbini
104       - shell: |
105           virtualenv $WORKSPACE/venv
106           source $WORKSPACE/venv/bin/activate
107           pip install --upgrade pip
108           pip freeze
109           pip install jenkins-job-builder
110           jenkins-jobs -l DEBUG test --recursive -o archives/job_output jjb/
111           gzip archives/job_output/*
112       - releng-check-unicode
113       - verify-gpg-signature
114
115     publishers:
116       - email-notification:
117           email-recipients: '{email-recipients}'
118           email-prefix: '[releng]'
119       - opendaylight-infra-shiplogs:
120           maven-version: 'mvn33'
121
122 - job-template:
123     name: 'builder-merge'
124     node: centos7-java-builder-2c-4g
125
126     # builder-merge job to run JJB update
127     #
128     # This job's purpose is to update all the JJB
129
130     project-type: freestyle
131
132     properties:
133       - opendaylight-infra-properties:
134           build-days-to-keep: 14
135
136     parameters:
137       - opendaylight-infra-parameters:
138           project: '{project}'
139           branch: '{branch}'
140           refspec: 'refs/heads/{branch}'
141           artifacts: '{archive-artifacts}'
142
143     scm:
144       - gerrit-trigger-scm:
145           refspec: ''
146           choosing-strategy: 'default'
147
148     wrappers:
149       - opendaylight-infra-wrappers:
150           build-timeout: '{build-timeout}'
151
152     triggers:
153       - gerrit:
154           server-name: '{server-name}'
155           trigger-on:
156             - change-merged-event
157             - comment-added-contains-event:
158                 comment-contains-value: 'remerge'
159           projects:
160             - project-compare-type: 'ANT'
161               project-pattern: 'releng/builder'
162               branches:
163                 - branch-compare-type: 'ANT'
164                   branch-pattern: '**/{branch}'
165               file-paths:
166                 - compare-type: ANT
167                   pattern: jjb/**
168
169     builders:
170       - opendaylight-infra-jjbini
171       - shell: |
172           virtualenv $WORKSPACE/venv
173           source $WORKSPACE/venv/bin/activate
174           pip install --upgrade pip
175           pip freeze
176           pip install jenkins-job-builder
177           jenkins-jobs --version
178           jenkins-jobs update --recursive --delete-old --workers 4 jjb/
179
180     publishers:
181       - email-notification:
182           email-recipients: '{email-recipients}'
183           email-prefix: '[releng]'
184       - opendaylight-infra-shiplogs:
185           maven-version: 'mvn33'
186
187 - job-template:
188     name: 'builder-weekly'
189     disabled: false
190     node: centos7-java-builder-2c-4g
191
192     # builder-weekly job to run JJB update weekly
193     #
194     # This job's purpose is to update all the JJB on a weekly (Sunday)
195     # basis with --flush-cache enabled to ensure jobs are okay
196
197     project-type: freestyle
198
199     properties:
200       - opendaylight-infra-properties:
201           build-days-to-keep: 14
202
203     parameters:
204       - opendaylight-infra-parameters:
205           project: '{project}'
206           branch: '{branch}'
207           refspec: 'refs/heads/{branch}'
208           artifacts: '{archive-artifacts}'
209
210     scm:
211       - git-scm:
212           branch: '{branch}'
213
214     wrappers:
215       - opendaylight-infra-wrappers:
216           build-timeout: '{build-timeout}'
217
218     triggers:
219       - timed: 'H H * * 0'
220
221     builders:
222       - opendaylight-infra-jjbini
223       - shell: |
224           virtualenv $WORKSPACE/venv
225           source $WORKSPACE/venv/bin/activate
226           pip install --upgrade pip
227           pip freeze
228           pip install jenkins-job-builder
229           jenkins-jobs --flush-cache update --recursive --workers 4 jjb/
230
231     publishers:
232       - email-notification:
233           email-recipients: '{email-recipients}'
234           email-prefix: '[releng]'
235       - opendaylight-infra-shiplogs:
236           maven-version: 'mvn33'
237
238 - job-template:
239     name: builder-check-poms
240     node: centos7-java-builder-2c-4g
241
242     project-type: freestyle
243
244     properties:
245       - opendaylight-infra-properties:
246           build-days-to-keep: 14
247
248     parameters:
249       - opendaylight-infra-parameters:
250           project: '{project}'
251           branch: '{branch}'
252           refspec: 'refs/heads/{branch}'
253           artifacts: '{archive-artifacts}'
254
255     wrappers:
256       - opendaylight-infra-wrappers:
257           build-timeout: '{build-timeout}'
258
259     triggers:
260       - timed: 'H H * * 1'
261
262     builders:
263       - shell: !include-raw-escape: include-raw-check-poms.sh
264
265     publishers:
266       - email-notification:
267           email-recipients: '{email-recipients}'
268           email-prefix: '[releng]'
269       - opendaylight-infra-shiplogs:
270           maven-version: 'mvn33'
271
272 - job-template:
273     name: 'builder-delete-stale-stacks'
274     project-type: freestyle
275     node: centos7-java-builder-2c-4g
276
277     properties:
278       - opendaylight-infra-properties:
279           build-days-to-keep: 7
280
281     wrappers:
282       - opendaylight-infra-wrappers:
283           build-timeout: '{build-timeout}'
284
285     triggers:
286       # Attempt to clear up stacks every 30 mins in case we have orphaned stacks
287       - timed: '0,30 * * * *'
288
289     builders:
290       - shell: !include-raw-escape: opendaylight-infra-cleanup-stale-stacks.sh
291
292     publishers:
293       - email-notification:
294           email-recipients: '{email-recipients}'
295           email-prefix: '[releng]'
296       - opendaylight-infra-shiplogs:
297           maven-version: 'mvn33'
298
299 - job-template:
300     name: 'builder-cleanup-old-images'
301     project-type: freestyle
302     node: centos7-java-builder-2c-4g
303
304     properties:
305       - opendaylight-infra-properties:
306           build-days-to-keep: 7
307
308     parameters:
309       - opendaylight-infra-parameters:
310           project: '{project}'
311           branch: '{branch}'
312           refspec: 'refs/heads/{branch}'
313           artifacts: '{archive-artifacts}'
314
315     scm:
316       - git-scm:
317           branch: '{branch}'
318
319     wrappers:
320       - opendaylight-infra-wrappers:
321           build-timeout: '{build-timeout}'
322       # Listed after to override openstack-infra-wrappers clouds.yaml definition
323       - config-file-provider:
324           files:
325             - file-id: opendaylight-private-clouds-yaml
326               target: '$HOME/.config/openstack/clouds.yaml'
327
328     triggers:
329       # Cleanup images on a weekly schedule
330       - timed: '@weekly'
331
332     builders:
333       - shell: !include-raw-escape: opendaylight-infra-cleanup-old-images.sh
334
335     publishers:
336       - email-notification:
337           email-recipients: '{email-recipients}'
338           email-prefix: '[releng]'
339       - opendaylight-infra-shiplogs:
340           maven-version: 'mvn33'
341
342 - job-template:
343     name: 'builder-update-image-list'
344     project-type: freestyle
345     node: centos7-java-builder-2c-4g
346
347     properties:
348       - opendaylight-infra-properties:
349           build-days-to-keep: 7
350
351     parameters:
352       - opendaylight-infra-parameters:
353           project: '{project}'
354           branch: '{branch}'
355           refspec: 'refs/heads/{branch}'
356           artifacts: '{archive-artifacts}'
357
358     scm:
359       - git-scm:
360           branch: '{branch}'
361
362     wrappers:
363       - opendaylight-infra-wrappers:
364           build-timeout: '{build-timeout}'
365       # Listed after to override openstack-infra-wrappers clouds.yaml definition
366       - config-file-provider:
367           files:
368             - file-id: opendaylight-private-clouds-yaml
369               target: '$HOME/.config/openstack/clouds.yaml'
370
371     triggers:
372       # Update image list every Monday to Friday at 11:00 UTC
373       - timed: '0 11 * * 1-5'
374
375     builders:
376       - shell: !include-raw-escape: opendaylight-infra-update-image-list.sh
377       - opendaylight-infra-push-gerrit-patch:
378           project: '{project}'
379           gerrit-topic: 'releng-update-cloud-image-list'
380           gerrit-commit-message: 'Update cloud image list docs'
381
382     publishers:
383       - email-notification:
384           email-recipients: '{email-recipients}'
385           email-prefix: '[releng]'
386       - opendaylight-infra-shiplogs:
387           maven-version: 'mvn33'
388
389 - job-template:
390     name: 'builder-verify-packer'
391     project-type: freestyle
392     node: centos7-java-builder-2c-4g
393     concurrent: true
394
395     properties:
396       - opendaylight-infra-properties:
397           build-days-to-keep: 14
398
399     parameters:
400       - opendaylight-infra-parameters:
401           project: '{project}'
402           branch: '{branch}'
403           refspec: 'refs/heads/{branch}'
404           artifacts: '{archive-artifacts}'
405
406     scm:
407       - gerrit-trigger-scm:
408           refspec: '$GERRIT_REFSPEC'
409           choosing-strategy: 'gerrit'
410
411     wrappers:
412       - opendaylight-infra-wrappers:
413           build-timeout: '{build-timeout}'
414
415     triggers:
416       - gerrit-trigger-patch-submitted:
417           server: '{server-name}'
418           project: '{project}'
419           branch: '{branch}'
420           files: 'packer/**'
421
422     builders:
423       - packer-validate:
424
425     publishers:
426       - email-notification:
427           email-recipients: '{email-recipients}'
428           email-prefix: '[{project}]'
429       - opendaylight-infra-shiplogs:
430           maven-version: 'mvn33'
431
432 - job-template:
433     name: 'builder-merge-packer-{platforms}-{templates}'
434     project-type: freestyle
435     node: centos7-java-builder-2c-4g
436
437     properties:
438       - opendaylight-infra-properties:
439           build-days-to-keep: 14
440
441     parameters:
442       - opendaylight-infra-parameters:
443           project: '{project}'
444           branch: '{branch}'
445           refspec: 'refs/heads/{branch}'
446           artifacts: '{archive-artifacts}'
447
448     scm:
449       - gerrit-trigger-scm:
450           refspec: '$GERRIT_REFSPEC'
451           branches:
452             - '$GERRIT_BRANCH'
453           choosing-strategy: 'default'
454
455     wrappers:
456       - opendaylight-infra-wrappers:
457           build-timeout: '{build-timeout}'
458
459     triggers:
460       - timed: '00 10 1 * *'
461       - gerrit:
462           server-name: '{server-name}'
463           trigger-on:
464             - change-merged-event
465             - comment-added-contains-event:
466                 comment-contains-value: 'remerge'
467           projects:
468             - project-compare-type: 'ANT'
469               project-pattern: 'releng/builder'
470               branches:
471                 - branch-compare-type: 'ANT'
472                   branch-pattern: '**/{branch}'
473               file-paths:
474                 - compare-type: ANT
475                   pattern: 'packer/vars/{platforms}.json'
476                 - compare-type: ANT
477                   pattern: 'packer/templates/{templates}.json'
478                 - compare-type: ANT
479                   pattern: 'packer/provision/{templates}.sh'
480                 - compare-type: ANT
481                   pattern: 'packer/provision/system_reseal.sh'
482                 - compare-type: ANT
483                   pattern: 'packer/provision/rh-user_data.sh'
484                 - compare-type: ANT
485                   pattern: 'packer/provision/devstack-pre-pip.sh'
486                 - compare-type: ANT
487                   pattern: 'packer/provision/baseline.sh'
488
489     builders:
490       - packer-validate:
491       - packer-build:
492           platform: '{platforms}'
493           template: '{templates}'
494
495     publishers:
496       - email-notification:
497           email-recipients: '{email-recipients}'
498           email-prefix: '[{project}]'
499       - opendaylight-infra-shiplogs:
500           maven-version: 'mvn33'
501
502 - job-template:
503     name: 'builder-update-csit-tests'
504     node: centos7-java-builder-2c-8g
505
506     # builder-update-csit-tests job
507     #
508     # This job's purpose is to update csit
509     # tests to run in integration-distribution-test-{stream}
510     # by updating releng-defaults variables: csit-list-carbon,
511     # csit-list-boron, csit-list-beryllium
512
513     project-type: freestyle
514
515     properties:
516       - opendaylight-infra-properties:
517           build-days-to-keep: 14
518
519     parameters:
520       - opendaylight-infra-parameters:
521           project: '{project}'
522           branch: '{branch}'
523           refspec: 'refs/heads/{branch}'
524           artifacts: '{archive-artifacts}'
525
526     scm:
527       - gerrit-trigger-scm:
528           refspec: ''
529           choosing-strategy: 'default'
530
531     wrappers:
532       - opendaylight-infra-wrappers:
533           build-timeout: '{build-timeout}'
534
535     triggers:
536       - reverse:
537           jobs: 'builder-merge'
538
539     builders:
540       - shell: |
541           git checkout -b auto-update-csit-jobs
542       - integration-list-jobs:
543           blacklist: '{csit-list-blacklist}'
544           search_string: "csit"
545           stream: "carbon"
546           jobs-filename: "csit_jobs_carbon.lst"
547       - integration-list-jobs:
548           blacklist: '{csit-list-blacklist}'
549           search_string: "csit"
550           stream: "boron"
551           jobs-filename: "csit_jobs_boron.lst"
552       - integration-list-jobs:
553           blacklist: '{csit-list-blacklist}'
554           search_string: "csit"
555           stream: "beryllium"
556           jobs-filename: "csit_jobs_beryllium.lst"
557       - integration-replace-block-text:
558           starting-regex: "'csit-list-carbon: >'"
559           ending-regex: "'csit-weekly-list-carbon: >'"
560           file-with-changes-to-insert: "'csit_jobs_carbon.lst'"
561           file-to-change: "'jjb/releng-defaults.yaml'"
562       - integration-replace-block-text:
563           starting-regex: "'csit-list-boron: >'"
564           ending-regex: "'csit-list-beryllium: >'"
565           file-with-changes-to-insert: "'csit_jobs_boron.lst'"
566           file-to-change: "'jjb/releng-defaults.yaml'"
567       - integration-replace-block-text:
568           starting-regex: "'csit-list-beryllium: >'"
569           ending-regex: "'# CSIT TESTS END SED MARKER'"
570           file-with-changes-to-insert: "'csit_jobs_beryllium.lst'"
571           file-to-change: "'jjb/releng-defaults.yaml'"
572       - shell: |
573           git status
574           git add jjb/releng-defaults.yaml
575       - opendaylight-infra-push-gerrit-patch:
576           project: "releng/builder"
577           gerrit-topic: "auto-update-csit-jobs"
578           gerrit-commit-message: "Auto Update CSIT Jobs to run"
579
580     publishers:
581       - email-notification:
582           email-recipients: '{email-recipients}'
583           email-prefix: '[releng]'
584       - opendaylight-infra-shiplogs:
585           maven-version: 'mvn33'