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