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