6dd16ab6666c6efc42d242ccceac1502171cd61d
[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'
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     parameters:
172         - project-parameter:
173             project: '{project}'
174         - fuel-parameter:
175             installer: '{installer}'
176             gs-pathname: '{gs-pathname}'
177
178     scm:
179         - git-scm:
180             credentials-id: '{ssh-credentials}'
181             refspec: ''
182             branch: master
183
184     logrotate:
185         daysToKeep: 30
186         numToKeep: 10
187         artifactDaysToKeep: -1
188         artifactNumToKeep: -1
189
190     builders:
191         - trigger-builds:
192           - project: 'genesis-fuel-build-{stream}'
193             git-revision: true
194             block: true
195         - trigger-builds:
196           - project: 'genesis-fuel-deploy-{stream}'
197             git-revision: true
198             block: true
199         - trigger-builds:
200           - project: 'functest-opnfv-jump-1'
201             block: true
202
203 - job-template:
204     name: 'genesis-fuel-build-{stream}'
205
206     project-type: freestyle
207
208     node: ericsson-build
209
210     logrotate:
211         daysToKeep: 30
212         numToKeep: 10
213         artifactDaysToKeep: -1
214         artifactNumToKeep: -1
215
216     parameters:
217         - project-parameter:
218             project: '{project}'
219         - fuel-parameter:
220             installer: '{installer}'
221             gs-pathname: '{gs-pathname}'
222
223     scm:
224         - git-scm:
225             credentials-id: '{ssh-credentials}'
226             refspec: ''
227             branch: master
228
229     builders:
230         - 'fuel-build'
231         - 'fuel-upload-artifact'
232         - 'fuel-workspace-cleanup'
233
234 - job-template:
235     name: 'genesis-fuel-deploy-{stream}'
236
237     project-type: freestyle
238
239     disabled: false
240
241     node: opnfv-jump-1
242
243     parameters:
244         - project-parameter:
245             project: '{project}'
246         - fuel-parameter:
247             installer: '{installer}'
248             gs-pathname: '{gs-pathname}'
249         - string:
250             name: GIT_BASE
251             default: ssh://gerrit.opnfv.org:29418/$PROJECT
252             description: "POD1 has some issues with cloning using https so that's why GIT_BASE is overriden here again."
253
254     scm:
255         - git-scm:
256             credentials-id: '{ssh-credentials}'
257             refspec: ''
258             branch: master
259
260     logrotate:
261         daysToKeep: 30
262         numToKeep: 10
263         artifactDaysToKeep: -1
264         artifactNumToKeep: -1
265
266     builders:
267         - 'fuel-download-artifact'
268         - 'fuel-deploy'
269
270 - job-template:
271     name: 'genesis-fuel-deploy-virtual'
272
273     project-type: freestyle
274
275     disabled: true
276
277     node: ericsson-build
278
279     parameters:
280         - project-parameter:
281             project: '{project}'
282         - fuel-parameter:
283             installer: '{installer}'
284             gs-pathname: ''
285
286     scm:
287         - git-scm:
288             credentials-id: '{ssh-credentials}'
289             refspec: ''
290             branch: master
291
292     logrotate:
293         daysToKeep: 30
294         numToKeep: 10
295         artifactDaysToKeep: -1
296         artifactNumToKeep: -1
297
298     builders:
299         - 'fuel-deploy-virtual'
300
301 ########################
302 # parameter macros
303 ########################
304 - parameter:
305     name: fuel-parameter
306     parameters:
307         - string:
308             name: INSTALLER
309             default: '{installer}'
310             description: "Installer to use."
311         - string:
312             name: BUILD_DIRECTORY
313             default: $WORKSPACE/build_output
314             description: "Directory where the build artifact will be located upon the completion of the build."
315         - string:
316             name: CACHE_DIRECTORY
317             default: $HOME/opnfv/cache/genesis-$INSTALLER
318             description: "Directory where the cache to be used during the build is located."
319         - string:
320             name: GIT_BASE
321             default: https://gerrit.opnfv.org/gerrit/$PROJECT
322             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
323         - string:
324             name: GS_PATHNAME
325             default: '{gs-pathname}'
326             description: "Subdirectory to store artifacts for different branches."
327         - string:
328             name: GS_URL
329             default: artifacts.opnfv.org/$PROJECT/$INSTALLER/$GS_PATHNAME
330             description: "URL to Google Storage."
331
332 ########################
333 # builder macros
334 ########################
335 - builder:
336     name: 'fuel-build'
337     builders:
338         - shell: |
339             #!/bin/bash
340             set -o errexit
341             set -o nounset
342             set -o pipefail
343
344             # log info to console
345             echo "Starting the build of $INSTALLER. This could take some time..."
346             echo "--------------------------------------------------------"
347             echo
348
349             # create the cache directory if it doesn't exist
350             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
351
352             # set OPNFV_ARTIFACT_VERSION
353             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
354
355             # start the build
356             cd $WORKSPACE/$INSTALLER/ci
357             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
358
359             # list the build artifacts
360             ls -al $BUILD_DIRECTORY
361
362             # save information regarding artifact into file
363             (
364                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
365                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
366                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
367                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
368                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
369                 echo "OPNFV_BUILD_URL=$BUILD_URL"
370             ) > $WORKSPACE/opnfv.properties
371
372             echo
373             echo "--------------------------------------------------------"
374             echo "Done!"
375
376 - builder:
377     name: 'fuel-deploy'
378     builders:
379         - shell: |
380             #!/bin/bash
381             set -o errexit
382             set -o nounset
383             set -o pipefail
384
385             # source the file so we get OPNFV vars
386             source latest.properties
387
388             # echo the info about artifact that is used during the deployment
389             echo "Using $(echo $OPNFV_ARTIFACT_URL | cut -d'/' -f4) for deployment"
390
391             # create TMPDIR if it doesn't exist
392             export TMPDIR=$HOME/tmpdir
393             [[ -d $TMPDIR ]] || mkdir -p $TMPDIR
394
395             # change permissions down to TMPDIR
396             chmod a+x $HOME
397             chmod a+x $TMPDIR
398
399             # set TOPDIR
400             export TOPDIR=$WORKSPACE/fuel/prototypes/auto-deploy
401
402             # log info to console
403             echo "Starting the deployment using $INSTALLER. This could take some time..."
404             echo "--------------------------------------------------------"
405             echo
406
407             # start the deployment
408             echo "Issuing command"
409             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"
410             sudo TMPDIR=${TMPDIR} ${TOPDIR}/deploy/deploy.sh ${WORKSPACE}/opnfv.iso ${TOPDIR}/configs/lf_pod1/dea_no-ha.yaml ${TOPDIR}/configs/lf_pod1/dha.yaml
411
412             echo
413             echo "--------------------------------------------------------"
414             echo "Done!"
415
416 - builder:
417     name: 'fuel-deploy-virtual'
418     builders:
419         - shell: |
420             #!/bin/bash
421             set -o errexit
422             set -o nounset
423             set -o pipefail
424
425             # log info to console
426             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
427             echo "--------------------------------------------------------"
428             echo
429
430             ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
431
432             echo
433             echo "--------------------------------------------------------"
434             echo "Done!"
435
436 - builder:
437     name: 'fuel-upload-artifact'
438     builders:
439         - shell: |
440             #!/bin/bash
441             set -o errexit
442             set -o nounset
443             set -o pipefail
444
445             # log info to console
446             echo "Uploading the $INSTALLER artifact. This could take some time..."
447             echo "--------------------------------------------------------"
448             echo
449
450             # source the opnfv.properties to get ARTIFACT_VERSION
451             source $WORKSPACE/opnfv.properties
452
453             # upload artifact and additional files to google storage
454             gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
455             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
456             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
457
458             echo
459             echo "--------------------------------------------------------"
460             echo "Done!"
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