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