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