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