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