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