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