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