1b163a042e5dc85e6b6896ea656c68e28a397972
[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'
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'
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-virtual'
420     builders:
421         - shell: |
422             #!/bin/bash
423             set -o errexit
424             set -o nounset
425             set -o pipefail
426
427             # log info to console
428             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
429             echo "--------------------------------------------------------"
430             echo
431
432             ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
433
434             echo
435             echo "--------------------------------------------------------"
436             echo "Done!"
437
438 - builder:
439     name: 'fuel-upload-artifact'
440     builders:
441         - shell: |
442             #!/bin/bash
443             set -o errexit
444             set -o nounset
445             set -o pipefail
446
447             # log info to console
448             echo "Uploading the $INSTALLER artifact. This could take some time..."
449             echo "--------------------------------------------------------"
450             echo
451
452             # source the opnfv.properties to get ARTIFACT_VERSION
453             source $WORKSPACE/opnfv.properties
454
455             # upload artifact and additional files to google storage
456             gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
457             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
458             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
459
460             echo
461             echo "--------------------------------------------------------"
462             echo "Done!"
463             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
464
465 - builder:
466     name: 'fuel-download-artifact'
467     builders:
468         - shell: |
469             #!/bin/bash
470             set -o errexit
471             set -o nounset
472             set -o pipefail
473
474             # get the latest.properties file in order to get info regarding latest artifact
475             curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
476
477             # check if we got the file
478             [[ -f latest.properties ]] || exit 1
479
480             # source the file so we get OPNFV vars
481             source latest.properties
482
483             # log info to console
484             echo "Downloading the $INSTALLER artifact using URL http://$OPNFV_ARTIFACT_URL"
485             echo "This could take some time..."
486             echo "--------------------------------------------------------"
487             echo
488
489             # download the file
490             curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
491
492             # list the file
493             ls -al $WORKSPACE/opnfv.iso
494
495             echo
496             echo "--------------------------------------------------------"
497             echo "Done!"
498
499 - builder:
500     name: 'fuel-workspace-cleanup'
501     builders:
502         - shell: |
503             #!/bin/bash
504             set -o errexit
505             set -o nounset
506             set -o pipefail
507
508             # delete everything that is in $WORKSPACE
509             /bin/rm -rf $WORKSPACE
510
511 ########################
512 # trigger macros
513 ########################
514 - trigger:
515     name: 'fuel-master'
516     triggers:
517         - pollscm: '0 21 * * *'
518
519 - trigger:
520     name: 'fuel-stable-arno'
521     triggers:
522         - pollscm: '0 3 * * *'