Enable genesis/fuel HA deployment in LF POD1
[releng.git] / jjb / genesis / genesis-fuel.yml
1 ########################
2 # Job configuration for genesis/fuel
3 ########################
4 - project:
5
6     name: genesis-fuel
7
8     project: 'genesis'
9
10     installer: 'fuel'
11
12     jobs:
13         - 'genesis-fuel-verify-{stream}'
14         - 'genesis-fuel-merge'
15         - 'genesis-fuel-daily-{stream}'
16         - 'genesis-fuel-build-{stream}'
17         - 'genesis-fuel-deploy-{stream}'
18         - 'genesis-fuel-deploy-virtual-master'
19
20     # stream:    branch with - in place of / (eg. stable-arno)
21     # branch:    branch (eg. stable/arno)
22     stream:
23         - master:
24             branch: 'master'
25             gs-pathname: ''
26         - stable-arno:
27             branch: 'stable/arno'
28             gs-pathname: '/arno'
29
30 ########################
31 # job templates
32 ########################
33
34 - job-template:
35     name: 'genesis-fuel-verify-{stream}'
36
37     project-type: freestyle
38
39     node: ericsson-build
40
41     concurrent: true
42
43     properties:
44         - throttle:
45             enabled: true
46             max-total: 3
47
48     logrotate:
49         daysToKeep: 30
50         numToKeep: 10
51         artifactDaysToKeep: -1
52         artifactNumToKeep: -1
53
54     parameters:
55         - project-parameter:
56             project: '{project}'
57         - gerrit-parameter:
58             branch: '{branch}'
59         - fuel-parameter:
60             installer: '{installer}'
61             gs-pathname: '{gs-pathname}'
62
63     scm:
64         - gerrit-trigger-scm:
65             credentials-id: '{ssh-credentials}'
66             refspec: '$GERRIT_REFSPEC'
67             choosing-strategy: 'gerrit'
68
69     wrappers:
70         - ssh-agent-credentials:
71             user: '{ssh-credentials}'
72
73     triggers:
74         - gerrit:
75             trigger-on:
76                 - patchset-created-event:
77                     exclude-drafts: 'false'
78                     exclude-trivial-rebase: 'false'
79                     exclude-no-code-change: 'false'
80                 - draft-published-event
81                 - comment-added-contains-event:
82                     comment-contains-value: 'recheck'
83                 - comment-added-contains-event:
84                     comment-contains-value: 'reverify'
85             projects:
86               - project-compare-type: 'ANT'
87                 project-pattern: 'genesis'
88                 branches:
89                   - branch-compare-type: 'ANT'
90                     branch-pattern: '**/{branch}'
91                 file-paths:
92                   - compare-type: ANT
93                     pattern: 'common/**'
94                   - compare-type: ANT
95                     pattern: '{installer}/**'
96
97     builders:
98         - 'fuel-build'
99         - 'fuel-workspace-cleanup'
100
101 - job-template:
102     name: 'genesis-fuel-merge'
103
104     project-type: freestyle
105
106     node: ericsson-build
107
108     concurrent: true
109
110     properties:
111         - throttle:
112             enabled: true
113             max-total: 2
114
115     logrotate:
116         daysToKeep: 30
117         numToKeep: 40
118         artifactDaysToKeep: -1
119         artifactNumToKeep: 5
120
121     parameters:
122         - project-parameter:
123             project: '{project}'
124         - gerrit-parameter:
125             branch: 'master'
126         - fuel-parameter:
127             installer: '{installer}'
128             gs-pathname: ''
129
130     scm:
131         - gerrit-trigger-scm:
132             credentials-id: '{ssh-credentials}'
133             refspec: ''
134             choosing-strategy: 'default'
135
136     wrappers:
137         - ssh-agent-credentials:
138             user: '{ssh-credentials}'
139
140     triggers:
141         - gerrit:
142             trigger-on:
143                 - change-merged-event
144                 - comment-added-contains-event:
145                     comment-contains-value: 'remerge'
146             projects:
147               - project-compare-type: 'ANT'
148                 project-pattern: 'genesis'
149                 branches:
150                     - branch-compare-type: 'ANT'
151                       branch-pattern: '**/master'
152                 file-paths:
153                   - compare-type: ANT
154                     pattern: 'common/**'
155                   - compare-type: ANT
156                     pattern: '{installer}/**'
157
158     builders:
159         - 'fuel-build'
160         - 'fuel-workspace-cleanup'
161
162 - job-template:
163     name: 'genesis-fuel-daily-{stream}'
164
165     project-type: freestyle
166
167     node: ericsson-build
168
169     disabled: false
170
171     triggers:
172         - 'fuel-{stream}'
173
174     parameters:
175         - project-parameter:
176             project: '{project}'
177         - fuel-parameter:
178             installer: '{installer}'
179             gs-pathname: '{gs-pathname}'
180
181     scm:
182         - git-scm:
183             credentials-id: '{ssh-credentials}'
184             refspec: ''
185             branch: '{branch}'
186
187     logrotate:
188         daysToKeep: 30
189         numToKeep: 10
190         artifactDaysToKeep: -1
191         artifactNumToKeep: -1
192
193     builders:
194         - trigger-builds:
195           - project: 'genesis-fuel-build-{stream}'
196             git-revision: true
197             block: true
198         - trigger-builds:
199           - project: 'genesis-fuel-deploy-{stream}'
200             git-revision: true
201             block: true
202         - trigger-builds:
203           - project: 'functest-opnfv-jump-1'
204             block: true
205         - trigger-builds:
206           - project: 'yardstick-opnfv-jump-1'
207             block: true
208
209 - job-template:
210     name: 'genesis-fuel-build-{stream}'
211
212     project-type: freestyle
213
214     node: ericsson-build
215
216     logrotate:
217         daysToKeep: 30
218         numToKeep: 10
219         artifactDaysToKeep: -1
220         artifactNumToKeep: -1
221
222     parameters:
223         - project-parameter:
224             project: '{project}'
225         - fuel-parameter:
226             installer: '{installer}'
227             gs-pathname: '{gs-pathname}'
228
229     scm:
230         - git-scm:
231             credentials-id: '{ssh-credentials}'
232             refspec: ''
233             branch: '{branch}'
234
235     builders:
236         - 'fuel-build'
237         - 'fuel-upload-artifact'
238         - 'fuel-workspace-cleanup'
239
240 - job-template:
241     name: 'genesis-fuel-deploy-{stream}'
242
243     project-type: freestyle
244
245     disabled: false
246
247     node: opnfv-jump-1
248
249     parameters:
250         - project-parameter:
251             project: '{project}'
252         - fuel-parameter:
253             installer: '{installer}'
254             gs-pathname: '{gs-pathname}'
255         - string:
256             name: GIT_BASE
257             default: ssh://gerrit.opnfv.org:29418/$PROJECT
258             description: "POD1 has some issues with cloning using https so that's why GIT_BASE is overriden here again."
259
260     scm:
261         - git-scm:
262             credentials-id: '{ssh-credentials}'
263             refspec: ''
264             branch: '{branch}'
265
266     logrotate:
267         daysToKeep: 30
268         numToKeep: 10
269         artifactDaysToKeep: -1
270         artifactNumToKeep: -1
271
272     builders:
273         - 'fuel-download-artifact'
274         - 'fuel-deploy-{stream}'
275
276 - job-template:
277     name: 'genesis-fuel-deploy-virtual-master'
278
279     project-type: freestyle
280
281     disabled: false
282
283     node: ericsson-build
284
285     parameters:
286         - project-parameter:
287             project: '{project}'
288         - fuel-parameter:
289             installer: '{installer}'
290             gs-pathname: ''
291
292     scm:
293         - git-scm:
294             credentials-id: '{ssh-credentials}'
295             refspec: ''
296             branch: master
297
298     logrotate:
299         daysToKeep: 30
300         numToKeep: 10
301         artifactDaysToKeep: -1
302         artifactNumToKeep: -1
303
304     builders:
305         - 'fuel-deploy-virtual'
306
307 ########################
308 # parameter macros
309 ########################
310 - parameter:
311     name: fuel-parameter
312     parameters:
313         - string:
314             name: INSTALLER
315             default: '{installer}'
316             description: "Installer to use."
317         - string:
318             name: BUILD_DIRECTORY
319             default: $WORKSPACE/build_output
320             description: "Directory where the build artifact will be located upon the completion of the build."
321         - string:
322             name: CACHE_DIRECTORY
323             default: $HOME/opnfv/cache/genesis-$INSTALLER
324             description: "Directory where the cache to be used during the build is located."
325         - string:
326             name: GIT_BASE
327             default: https://gerrit.opnfv.org/gerrit/$PROJECT
328             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
329         - string:
330             name: GS_URL
331             default: artifacts.opnfv.org/$PROJECT/$INSTALLER{gs-pathname}
332             description: "URL to Google Storage."
333
334 ########################
335 # builder macros
336 ########################
337 - builder:
338     name: 'fuel-build'
339     builders:
340         - shell: |
341             #!/bin/bash
342             set -o errexit
343             set -o nounset
344             set -o pipefail
345
346             # log info to console
347             echo "Starting the build of $INSTALLER. This could take some time..."
348             echo "--------------------------------------------------------"
349             echo
350
351             # create the cache directory if it doesn't exist
352             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
353
354             # set OPNFV_ARTIFACT_VERSION
355             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
356
357             # start the build
358             cd $WORKSPACE/$INSTALLER/ci
359             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
360
361             # list the build artifacts
362             ls -al $BUILD_DIRECTORY
363
364             # save information regarding artifact into file
365             (
366                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
367                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
368                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
369                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
370                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
371                 echo "OPNFV_BUILD_URL=$BUILD_URL"
372             ) > $WORKSPACE/opnfv.properties
373
374             echo
375             echo "--------------------------------------------------------"
376             echo "Done!"
377
378 - builder:
379     name: 'fuel-deploy-master'
380     builders:
381         - shell: |
382             #!/bin/bash
383             set -o errexit
384             set -o nounset
385             set -o pipefail
386
387             # source the file so we get OPNFV vars
388             source latest.properties
389
390             # echo the info about artifact that is used during the deployment
391             echo "Using $(echo $OPNFV_ARTIFACT_URL | cut -d'/' -f4) for deployment"
392
393             # create TMPDIR if it doesn't exist
394             export TMPDIR=$HOME/tmpdir
395             [[ -d $TMPDIR ]] || mkdir -p $TMPDIR
396
397             # change permissions down to TMPDIR
398             chmod a+x $HOME
399             chmod a+x $TMPDIR
400
401             # set TOPDIR
402             export TOPDIR=$WORKSPACE/fuel/prototypes/auto-deploy
403
404             # log info to console
405             echo "Starting the deployment using $INSTALLER. This could take some time..."
406             echo "--------------------------------------------------------"
407             echo
408
409             # start the deployment
410             echo "Issuing command"
411             echo "sudo TMPDIR=${TMPDIR} ${TOPDIR}/deploy/deploy.sh ${WORKSPACE}/opnfv.iso ${TOPDIR}/configs/lf_pod1/dea_no-ha.yaml ${TOPDIR}/configs/lf_pod1/dha.yaml"
412             sudo TMPDIR=${TMPDIR} ${TOPDIR}/deploy/deploy.sh ${WORKSPACE}/opnfv.iso ${TOPDIR}/configs/lf_pod1/dea_no-ha.yaml ${TOPDIR}/configs/lf_pod1/dha.yaml
413
414             echo
415             echo "--------------------------------------------------------"
416             echo "Done!"
417
418 - builder:
419     name: 'fuel-deploy-stable-arno'
420     builders:
421         - shell: |
422             #!/bin/bash
423             set -o errexit
424             set -o nounset
425             set -o pipefail
426
427             # source the file so we get OPNFV vars
428             source latest.properties
429
430             # echo the info about artifact that is used during the deployment
431             echo "Using $(echo $OPNFV_ARTIFACT_URL | cut -d'/' -f4) for deployment"
432
433             # create TMPDIR if it doesn't exist
434             export TMPDIR=$HOME/tmp/$JOB_NAME
435             [[ -d $TMPDIR ]] || mkdir -p $TMPDIR
436
437             # change permissions down to TMPDIR
438             chmod a+x $HOME
439             chmod a+x $TMPDIR
440
441             # log info to console
442             echo "Starting the deployment using $INSTALLER. This could take some time..."
443             echo "--------------------------------------------------------"
444             echo
445
446             # start the deployment
447             echo "Issuing command"
448             echo "sudo $WORKSPACE/fuel/ci/deploy.sh $WORKSPACE/opnfv.iso $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dea.yaml $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dha.yaml -s $TMPDIR"
449
450             sudo $WORKSPACE/fuel/ci/deploy.sh $WORKSPACE/opnfv.iso $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dea.yaml $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dha.yaml -s $TMPDIR
451             echo
452             echo "--------------------------------------------------------"
453             echo "Done!"
454
455 - builder:
456     name: 'fuel-deploy-virtual'
457     builders:
458         - shell: |
459             #!/bin/bash
460             set -o errexit
461             set -o nounset
462             set -o pipefail
463
464             # log info to console
465             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
466             echo "--------------------------------------------------------"
467             echo
468
469             ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
470
471             echo
472             echo "--------------------------------------------------------"
473             echo "Done!"
474
475 - builder:
476     name: 'fuel-upload-artifact'
477     builders:
478         - shell: |
479             #!/bin/bash
480             set -o errexit
481             set -o nounset
482             set -o pipefail
483
484             # log info to console
485             echo "Uploading the $INSTALLER artifact. This could take some time..."
486             echo "--------------------------------------------------------"
487             echo
488
489             # source the opnfv.properties to get ARTIFACT_VERSION
490             source $WORKSPACE/opnfv.properties
491
492             # upload artifact and additional files to google storage
493             gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
494             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
495             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
496
497             echo
498             echo "--------------------------------------------------------"
499             echo "Done!"
500             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
501
502 - builder:
503     name: 'fuel-download-artifact'
504     builders:
505         - shell: |
506             #!/bin/bash
507             set -o errexit
508             set -o nounset
509             set -o pipefail
510
511             # get the latest.properties file in order to get info regarding latest artifact
512             curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
513
514             # check if we got the file
515             [[ -f latest.properties ]] || exit 1
516
517             # source the file so we get OPNFV vars
518             source latest.properties
519
520             # log info to console
521             echo "Downloading the $INSTALLER artifact using URL http://$OPNFV_ARTIFACT_URL"
522             echo "This could take some time..."
523             echo "--------------------------------------------------------"
524             echo
525
526             # download the file
527             curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
528
529             # list the file
530             ls -al $WORKSPACE/opnfv.iso
531
532             echo
533             echo "--------------------------------------------------------"
534             echo "Done!"
535
536 - builder:
537     name: 'fuel-workspace-cleanup'
538     builders:
539         - shell: |
540             #!/bin/bash
541             set -o errexit
542             set -o nounset
543             set -o pipefail
544
545             # delete everything that is in $WORKSPACE
546             /bin/rm -rf $WORKSPACE
547
548 ########################
549 # trigger macros
550 ########################
551 - trigger:
552     name: 'fuel-master'
553     triggers:
554         - pollscm: '0 21 * * *'
555
556 - trigger:
557     name: 'fuel-stable-arno'
558     triggers:
559         - pollscm: '0 3 * * *'