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