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