Removing ODL build job, not needed for Fuel Autodeployment anymore
[releng.git] / jjb / genesis / genesis-fuel.yml
1 ########################
2 # Job configuration for genesis/fuel
3 ########################
4 - project:
5
6     name: genesis-fuel
7
8     project: 'genesis'
9
10     installer: 'fuel'
11
12     jobs:
13         - 'genesis-fuel-verify-build-{stream}'
14         - 'genesis-fuel-merge-{stream}'
15         - 'genesis-fuel-daily-{stream}'
16         - 'genesis-fuel-build-{stream}'
17         - 'genesis-fuel-deploy-{stream}'
18         - 'genesis-fuel-deploy-runner-{stream}'
19         - 'genesis-fuel-lab-reconfig-{stream}'
20         - 'genesis-fuel-verify-deploy-virtual-{stream}'
21
22     # stream:    branch with - in place of / (eg. stable-arno)
23     # branch:    branch (eg. stable/arno)
24     stream:
25         - master:
26             branch: 'master'
27             gs-pathname: ''
28             disabled: true
29         - stable-arno:
30             branch: 'stable/arno'
31             gs-pathname: '/arno'
32             disabled: false
33
34 ########################
35 # job templates
36 ########################
37
38 - job-template:
39     name: 'genesis-fuel-verify-build-{stream}'
40
41     project-type: freestyle
42
43     node: ericsson-build
44
45     concurrent: true
46
47     properties:
48         - throttle:
49             enabled: true
50             max-total: 3
51
52     logrotate:
53         daysToKeep: 30
54         numToKeep: 10
55         artifactDaysToKeep: -1
56         artifactNumToKeep: -1
57
58     parameters:
59         - project-parameter:
60             project: '{project}'
61         - gerrit-parameter:
62             branch: '{branch}'
63         - fuel-parameter:
64             installer: '{installer}'
65             gs-pathname: '{gs-pathname}'
66
67     scm:
68         - gerrit-trigger-scm:
69             credentials-id: '{ssh-credentials}'
70             refspec: '$GERRIT_REFSPEC'
71             choosing-strategy: 'gerrit'
72
73     wrappers:
74         - ssh-agent-credentials:
75             user: '{ssh-credentials}'
76
77     triggers:
78         - gerrit:
79             trigger-on:
80                 - patchset-created-event:
81                     exclude-drafts: 'false'
82                     exclude-trivial-rebase: 'false'
83                     exclude-no-code-change: 'false'
84                 - draft-published-event
85                 - comment-added-contains-event:
86                     comment-contains-value: 'recheck'
87                 - comment-added-contains-event:
88                     comment-contains-value: 'reverify'
89             projects:
90               - project-compare-type: 'ANT'
91                 project-pattern: 'genesis'
92                 branches:
93                   - branch-compare-type: 'ANT'
94                     branch-pattern: '**/{branch}'
95                 file-paths:
96                   - compare-type: ANT
97                     pattern: 'common/ci/**'
98                   - compare-type: ANT
99                     pattern: 'common/manifests/**'
100                   - compare-type: ANT
101                     pattern: 'common/puppet-opnfv/**'
102                   - compare-type: ANT
103                     pattern: 'common/tools/**'
104                   - compare-type: ANT
105                     pattern: '{installer}/build/**'
106                   - compare-type: ANT
107                     pattern: '{installer}/ci/**'
108                   - compare-type: ANT
109                     pattern: '{installer}/deploy/**'
110                   - compare-type: ANT
111                     pattern: '{installer}/include/**'
112                   - compare-type: ANT
113                     pattern: '{installer}/prototypes/**'
114                 forbidden-file-paths:
115                   - compare-type: ANT
116                     pattern: 'common/docs/**'
117                   - compare-type: ANT
118                     pattern: '{installer}/docs/**'
119
120     builders:
121         - 'fuel-build'
122         - 'fuel-workspace-cleanup'
123
124 - job-template:
125     name: 'genesis-fuel-merge-{stream}'
126
127     project-type: freestyle
128
129     node: ericsson-build
130
131     concurrent: true
132
133     properties:
134         - throttle:
135             enabled: true
136             max-total: 2
137
138     logrotate:
139         daysToKeep: 30
140         numToKeep: 40
141         artifactDaysToKeep: -1
142         artifactNumToKeep: 5
143
144     parameters:
145         - project-parameter:
146             project: '{project}'
147         - gerrit-parameter:
148             branch: '{branch}'
149         - fuel-parameter:
150             installer: '{installer}'
151             gs-pathname: ''
152
153     scm:
154         - gerrit-trigger-scm:
155             credentials-id: '{ssh-credentials}'
156             refspec: ''
157             choosing-strategy: 'default'
158
159     wrappers:
160         - ssh-agent-credentials:
161             user: '{ssh-credentials}'
162
163     triggers:
164         - gerrit:
165             trigger-on:
166                 - change-merged-event
167                 - comment-added-contains-event:
168                     comment-contains-value: 'remerge'
169             projects:
170               - project-compare-type: 'ANT'
171                 project-pattern: 'genesis'
172                 branches:
173                   - branch-compare-type: 'ANT'
174                     branch-pattern: '**/{branch}'
175                 file-paths:
176                   - compare-type: ANT
177                     pattern: 'common/ci/**'
178                   - compare-type: ANT
179                     pattern: 'common/manifests/**'
180                   - compare-type: ANT
181                     pattern: 'common/puppet-opnfv/**'
182                   - compare-type: ANT
183                     pattern: 'common/tools/**'
184                   - compare-type: ANT
185                     pattern: '{installer}/build/**'
186                   - compare-type: ANT
187                     pattern: '{installer}/ci/**'
188                   - compare-type: ANT
189                     pattern: '{installer}/deploy/**'
190                   - compare-type: ANT
191                     pattern: '{installer}/include/**'
192                   - compare-type: ANT
193                     pattern: '{installer}/prototypes/**'
194                 forbidden-file-paths:
195                   - compare-type: ANT
196                     pattern: 'common/docs/**'
197                   - compare-type: ANT
198                     pattern: '{installer}/docs/**'
199
200     builders:
201         - 'fuel-build'
202         - 'fuel-workspace-cleanup'
203
204 - job-template:
205     name: 'genesis-fuel-daily-{stream}'
206
207     project-type: freestyle
208
209     node: ericsson-build
210
211     disabled: '{obj:disabled}'
212
213     triggers:
214         - 'fuel-{stream}'
215
216     parameters:
217         - project-parameter:
218             project: '{project}'
219         - fuel-parameter:
220             installer: '{installer}'
221             gs-pathname: '{gs-pathname}'
222
223     scm:
224         - git-scm:
225             credentials-id: '{ssh-credentials}'
226             refspec: ''
227             branch: '{branch}'
228
229     logrotate:
230         daysToKeep: 30
231         numToKeep: 10
232         artifactDaysToKeep: -1
233         artifactNumToKeep: -1
234
235     builders:
236         - trigger-builds:
237           - project: 'genesis-fuel-build-{stream}'
238             git-revision: true
239             block: true
240         - trigger-builds:
241           - project: 'genesis-fuel-lab-reconfig-{stream}'
242             git-revision: true
243             block: true
244         - trigger-builds:
245           - project: 'genesis-fuel-deploy-{stream}'
246             git-revision: true
247             block: true
248         - trigger-builds:
249           - project: 'functest-fuel-{stream}'
250             block: true
251             block-thresholds:
252                 build-step-failure-threshold: 'never'
253                 failure-threshold: 'never'
254                 unstable-threshold: 'FAILURE'
255         # - trigger-builds:
256           # - project: 'yardstick-fuel-{stream}'
257             # block: true
258             # block-thresholds:
259                 # build-step-failure-threshold: 'never'
260                 # failure-threshold: 'never'
261                 # unstable-threshold: 'FAILURE'
262
263     publishers:
264         - trigger-parameterized-builds:
265             - project: 'genesis-foreman-daily-{stream}'
266
267 - job-template:
268     name: 'genesis-fuel-deploy-runner-{stream}'
269
270     project-type: freestyle
271
272     disabled: false
273
274     node: master
275
276     logrotate:
277         daysToKeep: 30
278         numToKeep: 10
279         artifactDaysToKeep: -1
280         artifactNumToKeep: -1
281
282     parameters:
283         - project-parameter:
284             project: '{project}'
285         - fuel-parameter:
286             installer: '{installer}'
287             gs-pathname: '{gs-pathname}'
288         - string:
289             name: GIT_BASE
290             default: ssh://gerrit.opnfv.org:29418/$PROJECT
291             description: "Used for overriding the GIT URL coming from parameters macro."
292
293     scm:
294         - git-scm:
295             credentials-id: '{ssh-credentials}'
296             refspec: ''
297             branch: '{branch}'
298
299     properties:
300         - build-blocker:
301             use-build-blocker: true
302             blocking-jobs:
303                 - "genesis-foreman-daily.*"
304                 - "genesis-foreman-deploy-runner-{stream}"
305                 - "genesis-fuel-daily.*"
306
307     builders:
308         - 'fuel-lab-reconfig'
309         - trigger-builds:
310           - project: 'genesis-fuel-deploy-{stream}'
311             git-revision: true
312             block: true
313
314 - job-template:
315     name: 'genesis-fuel-build-{stream}'
316
317     project-type: freestyle
318
319     node: ericsson-build
320
321     logrotate:
322         daysToKeep: 30
323         numToKeep: 10
324         artifactDaysToKeep: -1
325         artifactNumToKeep: -1
326
327     parameters:
328         - project-parameter:
329             project: '{project}'
330         - fuel-parameter:
331             installer: '{installer}'
332             gs-pathname: '{gs-pathname}'
333
334     scm:
335         - git-scm:
336             credentials-id: '{ssh-credentials}'
337             refspec: ''
338             branch: '{branch}'
339
340     builders:
341         - 'fuel-build'
342         - 'fuel-upload-artifact'
343         - 'fuel-workspace-cleanup'
344
345     publishers:
346         - email:
347             recipients: jonas.bjurel@ericsson.com stefan.k.berg@ericsson.com
348
349 - job-template:
350     name: 'genesis-fuel-deploy-{stream}'
351
352     project-type: freestyle
353
354     disabled: false
355
356     node: opnfv-jump-2
357
358     parameters:
359         - project-parameter:
360             project: '{project}'
361         - fuel-parameter:
362             installer: '{installer}'
363             gs-pathname: '{gs-pathname}'
364         - string:
365             name: GIT_BASE
366             default: ssh://gerrit.opnfv.org:29418/$PROJECT
367             description: "POD2 has some issues with cloning using https so that's why GIT_BASE is overriden here again."
368
369     scm:
370         - git-scm:
371             credentials-id: '{ssh-credentials}'
372             refspec: ''
373             branch: '{branch}'
374
375     logrotate:
376         daysToKeep: 30
377         numToKeep: 10
378         artifactDaysToKeep: -1
379         artifactNumToKeep: -1
380
381     builders:
382         - 'fuel-download-artifact'
383         - 'fuel-deploy'
384
385     publishers:
386         - email:
387             recipients: jonas.bjurel@ericsson.com stefan.k.berg@ericsson.com
388
389 - job-template:
390     name: 'genesis-fuel-lab-reconfig-{stream}'
391
392     project-type: freestyle
393
394     disabled: false
395
396     node: master
397
398     logrotate:
399         daysToKeep: 30
400         numToKeep: 10
401         artifactDaysToKeep: -1
402         artifactNumToKeep: -1
403
404     parameters:
405         - project-parameter:
406             project: '{project}'
407         - fuel-parameter:
408             installer: '{installer}'
409             gs-pathname: '{gs-pathname}'
410         - string:
411             name: GIT_BASE
412             default: ssh://gerrit.opnfv.org:29418/$PROJECT
413             description: "Used for overriding the GIT URL coming from parameters macro."
414
415     scm:
416         - git-scm:
417             credentials-id: '{ssh-credentials}'
418             refspec: ''
419             branch: '{branch}'
420
421     properties:
422         - build-blocker:
423             use-build-blocker: true
424             blocking-jobs:
425                 - "genesis-foreman-daily.*"
426
427     builders:
428         - 'fuel-lab-reconfig'
429
430 - job-template:
431     name: 'genesis-fuel-verify-deploy-virtual-{stream}'
432
433     project-type: freestyle
434
435     disabled: true
436
437     node: ericsson-build
438
439     parameters:
440         - project-parameter:
441             project: '{project}'
442         - fuel-parameter:
443             installer: '{installer}'
444             gs-pathname: ''
445
446     scm:
447         - git-scm:
448             credentials-id: '{ssh-credentials}'
449             refspec: ''
450             branch: 'master'
451
452     logrotate:
453         daysToKeep: 30
454         numToKeep: 10
455         artifactDaysToKeep: -1
456         artifactNumToKeep: -1
457
458     builders:
459         - 'fuel-deploy-virtual'
460
461 ########################
462 # parameter macros
463 ########################
464 - parameter:
465     name: fuel-parameter
466     parameters:
467         - string:
468             name: INSTALLER
469             default: '{installer}'
470             description: "Installer to use."
471         - string:
472             name: BUILD_DIRECTORY
473             default: $WORKSPACE/build_output
474             description: "Directory where the build artifact will be located upon the completion of the build."
475         - string:
476             name: CACHE_DIRECTORY
477             default: $HOME/opnfv/cache/genesis-$INSTALLER
478             description: "Directory where the cache to be used during the build is located."
479         - string:
480             name: GIT_BASE
481             default: https://gerrit.opnfv.org/gerrit/$PROJECT
482             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
483         - string:
484             name: GS_URL
485             default: artifacts.opnfv.org/$PROJECT/$INSTALLER{gs-pathname}
486             description: "URL to Google Storage."
487
488 ########################
489 # builder macros
490 ########################
491 - builder:
492     name: 'fuel-build'
493     builders:
494         - shell: |
495             #!/bin/bash
496             set -o errexit
497             set -o nounset
498             set -o pipefail
499
500             # log info to console
501             echo "Starting the build of $INSTALLER. This could take some time..."
502             echo "--------------------------------------------------------"
503             echo
504
505             # create the cache directory if it doesn't exist
506             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
507
508             # set OPNFV_ARTIFACT_VERSION
509             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
510
511             # start the build
512             cd $WORKSPACE/$INSTALLER/ci
513             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
514
515             # list the build artifacts
516             ls -al $BUILD_DIRECTORY
517
518             # save information regarding artifact into file
519             (
520                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
521                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
522                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
523                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
524                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
525                 echo "OPNFV_BUILD_URL=$BUILD_URL"
526             ) > $WORKSPACE/opnfv.properties
527
528             echo
529             echo "--------------------------------------------------------"
530             echo "Done!"
531
532 - builder:
533     name: 'fuel-deploy'
534     builders:
535         - shell: |
536             #!/bin/bash
537             set -o errexit
538             set -o nounset
539             set -o pipefail
540
541             # source the file so we get OPNFV vars
542             source latest.properties
543
544             # echo the info about artifact that is used during the deployment
545             echo "Using $(echo $OPNFV_ARTIFACT_URL | cut -d'/' -f4) for deployment"
546
547             # create TMPDIR if it doesn't exist
548             export TMPDIR=$HOME/tmpdir
549             [[ -d $TMPDIR ]] || mkdir -p $TMPDIR
550
551             # change permissions down to TMPDIR
552             chmod a+x $HOME
553             chmod a+x $TMPDIR
554
555             # set CONFDIR, BRIDGE
556             export CONFDIR=$WORKSPACE/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2
557             export BRIDGE=pxebr
558
559             # cleanup first
560             sudo $WORKSPACE/common/ci/clean.sh -base_config $WORKSPACE/foreman/ci/inventory/lf_pod2_ksgen_settings.yml
561
562             # prepare for Fuel Deployment
563             sudo $WORKSPACE/common/ci/setup.sh
564
565             # log info to console
566             echo "Starting the deployment using $INSTALLER. This could take some time..."
567             echo "--------------------------------------------------------"
568             echo
569
570             # start the deployment
571             echo "Issuing command"
572             echo "sudo $WORKSPACE/fuel/ci/deploy.sh -iso $WORKSPACE/opnfv.iso -dea $CONFDIR/dea.yaml -dha $CONFDIR/dha.yaml -s $TMPDIR -b $BRIDGE -nh"
573             sudo $WORKSPACE/fuel/ci/deploy.sh -iso $WORKSPACE/opnfv.iso -dea $CONFDIR/dea.yaml -dha $CONFDIR/dha.yaml -s $TMPDIR -b $BRIDGE -nh
574
575             echo
576             echo "--------------------------------------------------------"
577             echo "Done!"
578
579 - builder:
580     name: 'fuel-deploy-virtual'
581     builders:
582         - shell: |
583             #!/bin/bash
584             set -o errexit
585             set -o nounset
586             set -o pipefail
587
588             # log info to console
589             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
590             echo "--------------------------------------------------------"
591             echo
592
593             ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
594
595             echo
596             echo "--------------------------------------------------------"
597             echo "Done!"
598
599 - builder:
600     name: 'fuel-upload-artifact'
601     builders:
602         - shell: |
603             #!/bin/bash
604             set -o errexit
605             set -o nounset
606             set -o pipefail
607
608             # log info to console
609             echo "Uploading the $INSTALLER artifact. This could take some time..."
610             echo "--------------------------------------------------------"
611             echo
612
613             # source the opnfv.properties to get ARTIFACT_VERSION
614             source $WORKSPACE/opnfv.properties
615
616             # upload artifact and additional files to google storage
617             gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
618             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
619             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
620
621             echo
622             echo "--------------------------------------------------------"
623             echo "Done!"
624             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
625
626 - builder:
627     name: 'fuel-download-artifact'
628     builders:
629         - shell: |
630             #!/bin/bash
631             set -o errexit
632             set -o nounset
633             set -o pipefail
634
635             # get the latest.properties file in order to get info regarding latest artifact
636             curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
637
638             # check if we got the file
639             [[ -f latest.properties ]] || exit 1
640
641             # source the file so we get OPNFV vars
642             source latest.properties
643
644             # log info to console
645             echo "Downloading the $INSTALLER artifact using URL http://$OPNFV_ARTIFACT_URL"
646             echo "This could take some time..."
647             echo "--------------------------------------------------------"
648             echo
649
650             # download the file
651             curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
652
653             # list the file
654             ls -al $WORKSPACE/opnfv.iso
655
656             echo
657             echo "--------------------------------------------------------"
658             echo "Done!"
659
660 - builder:
661     name: 'fuel-workspace-cleanup'
662     builders:
663         - shell: |
664             #!/bin/bash
665             set -o errexit
666             set -o nounset
667             set -o pipefail
668
669             # delete everything that is in $WORKSPACE
670             /bin/rm -rf $WORKSPACE
671
672 - builder:
673     name: 'fuel-lab-reconfig'
674     builders:
675         - shell: |
676             #!/bin/bash
677             set -o errexit
678             set -o nounset
679             set -o pipefail
680
681             # check to see if ucs login info file exists
682             if [ -e ~/.ssh/ucs_creds ];then
683               source ~/.ssh/ucs_creds
684             else
685               echo "Unable to find UCS credentials for LF lab reconfiguration...Exiting"
686               exit 1
687             fi
688
689             # clone releng
690             echo "Cloning releng repo..."
691             if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/releng; then
692               echo "Unable to clone releng repo...Exiting"
693               exit 1
694             fi
695
696             # log info to console
697             echo "Starting the lab reconfiguration for $INSTALLER..."
698             echo "--------------------------------------------------------"
699             echo
700
701             # create venv
702             $WORKSPACE/releng/utils/lab-reconfiguration/create_venv.sh
703
704             # disable nounset because 'activate' script contains unbound variable(s)
705             set +o nounset
706             # enter venv
707             source $WORKSPACE/releng/utils/lab-reconfiguration/venv/bin/activate
708             # set nounset back again
709             set -o nounset
710
711             # verify we are in venv
712             if [[ ! $(which python | grep venv) ]]; then
713               echo "Unable to activate venv...Exiting"
714               exit 1
715             fi
716
717             python $WORKSPACE/releng/utils/lab-reconfiguration/reconfigUcsNet.py -i $ucs_host -u $ucs_user -p $ucs_password -f $WORKSPACE/releng/utils/lab-reconfiguration/fuel.yaml
718
719             # while undergoing reboot
720             sleep 30
721
722             # check to see if slave is back up
723             ping_counter=0
724             ping_flag=0
725             while [ "$ping_counter" -lt 20 ]; do
726               if [[ $(ping -c 5 172.30.10.72) ]]; then
727                 ping_flag=1
728                 break
729               fi
730               ((ping_counter++))
731               sleep 10
732             done
733
734             if [ "$ping_flag" -eq 1 ]; then
735               echo "Slave is pingable, now wait 180 seconds for services to start"
736               sleep 180
737             else
738               echo "Slave did not come back up after reboot: please check opnfv-jump-2"
739               exit 1
740             fi
741
742             set +o nounset
743             deactivate
744
745             echo
746             echo "--------------------------------------------------------"
747             echo "Done!"
748
749 ########################
750 # trigger macros
751 ########################
752 - trigger:
753     name: 'fuel-master'
754     triggers:
755         - timed: '0 5 * * *'
756
757 - trigger:
758     name: 'fuel-stable-arno'
759     triggers:
760         - timed: '0 7 * * *'