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