6662c7d19a926ce309e7042935a86bdf5b21ff65
[releng.git] / jjb / genesis / genesis-fuel.yml
1 # this is the job configuration for bgs
2 - project:
3
4     name: genesis-fuel
5
6     installer:
7         - fuel
8     jobs:
9         - 'genesis-fuel-verify'
10         - 'genesis-fuel-merge'
11         - 'genesis-fuel-daily-{stream}'
12         - 'genesis-fuel-build'
13         - 'genesis-fuel-deploy'
14         - 'genesis-fuel-test'
15
16     # stream:    branch with - in place of / (eg. stable-helium)
17     # branch:    branch (eg. stable/helium)
18     stream:
19         - master:
20             branch: 'master'
21
22     project: 'genesis'
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         - string:
50             name: GIT_BASE
51             default: https://gerrit.opnfv.org/gerrit/genesis
52             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
53         - string:
54             name: GS_URL
55             default: 'artifacts.opnfv.org/genesis/fuel'
56             description: "URL to Google Storage."
57         - string:
58             name: BUILD_DIRECTORY
59             default: $WORKSPACE/build_output
60             description: "Directory where the build artifact will be located upon the completion of the build."
61         - string:
62             name: CACHE_DIRECTORY
63             default: $HOME/opnfv/cache/genesis-fuel
64             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
65         - string:
66             name: ARTIFACT_VERSION
67             default: $BUILD_ID
68             description: "Version number to append to resulting ISO."
69         - gerrit-parameter:
70             branch: 'master'
71
72     scm:
73         - gerrit-trigger-scm:
74             credentials-id: '{ssh-credentials}'
75             refspec: '$GERRIT_REFSPEC'
76             choosing-strategy: 'gerrit'
77
78     wrappers:
79         - ssh-agent-credentials:
80             user: '{ssh-credentials}'
81
82     triggers:
83         - gerrit:
84             trigger-on:
85                 - patchset-created-event:
86                     exclude-drafts: 'false'
87                     exclude-trivial-rebase: 'false'
88                     exclude-no-code-change: 'false'
89                 - draft-published-event
90                 - comment-added-contains-event:
91                     comment-contains-value: 'recheck'
92                 - comment-added-contains-event:
93                     comment-contains-value: 'reverify'
94             projects:
95               - project-compare-type: 'ANT'
96                 project-pattern: 'genesis'
97                 branches:
98                   - branch-compare-type: 'ANT'
99                     branch-pattern: '**/master'
100                 file-paths:
101                   - compare-type: ANT
102                     pattern: 'common/**'
103                   - compare-type: ANT
104                     pattern: 'fuel/**'
105
106
107     builders:
108         - 'installer-build'
109         - 'installer-cleanup'
110
111 - job-template:
112     name: 'genesis-fuel-merge'
113
114     # builder-merge job to run JJB update
115     #
116     # This job's purpose is to update all the JJB
117
118     project-type: freestyle
119
120     node: ericsson-build
121
122     concurrent: true
123
124     properties:
125         - throttle:
126             enabled: true
127             max-total: 2
128
129     logrotate:
130         daysToKeep: 30
131         numToKeep: 40
132         artifactDaysToKeep: -1
133         artifactNumToKeep: 5
134
135     parameters:
136         - string:
137             name: GIT_BASE
138             default: https://gerrit.opnfv.org/gerrit/genesis
139             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
140         - string:
141             name: GS_URL
142             default: 'artifacts.opnfv.org/genesis/fuel'
143             description: "URL to Google Storage."
144         - string:
145             name: BUILD_DIRECTORY
146             default: $WORKSPACE/build_output
147             description: "Directory where the build artifact will be located upon the completion of the build."
148         - string:
149             name: CACHE_DIRECTORY
150             default: $HOME/opnfv/cache/genesis-fuel
151             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
152         - string:
153             name: ARTIFACT_VERSION
154             default: $BUILD_ID
155             description: "Version number to append to resulting ISO."
156         - gerrit-parameter:
157             branch: 'master'
158
159     scm:
160         - gerrit-trigger-scm:
161             credentials-id: '{ssh-credentials}'
162             refspec: ''
163             choosing-strategy: 'default'
164
165     wrappers:
166         - ssh-agent-credentials:
167             user: '{ssh-credentials}'
168
169     triggers:
170         - gerrit:
171             trigger-on:
172                 - change-merged-event
173                 - comment-added-contains-event:
174                     comment-contains-value: 'remerge'
175             projects:
176               - project-compare-type: 'ANT'
177                 project-pattern: 'genesis'
178                 branches:
179                     - branch-compare-type: 'ANT'
180                       branch-pattern: '**/master'
181                 file-paths:
182                   - compare-type: ANT
183                     pattern: 'common/**'
184                   - compare-type: ANT
185                     pattern: 'fuel/**'
186
187     builders:
188         - 'installer-build'
189         - 'installer-cleanup'
190
191 - job-template:
192     name: 'genesis-fuel-daily-{stream}'
193
194     project-type: freestyle
195
196     node: ericsson-build
197
198     parameters:
199         - string:
200             name: GIT_BASE
201             default: https://gerrit.opnfv.org/gerrit/genesis
202             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
203         - string:
204             name: GERRIT_BRANCH
205             default: origin/master
206             description: "Branch to build, deploy and test."
207         - string:
208             name: GERRIT_REFSPEC
209             default: refs/heads/master
210             description: "Refspec to retrieve."
211         - string:
212             name: GS_URL
213             default: 'artifacts.opnfv.org/genesis/fuel'
214             description: "URL to Google Storage."
215         - string:
216             name: BUILD_DIRECTORY
217             default: $WORKSPACE/build_output
218             description: "Directory where the build artifact will be located upon the completion of the build."
219         - string:
220             name: CACHE_DIRECTORY
221             default: $HOME/opnfv/cache/genesis-fuel
222             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
223         - string:
224             name: ARTIFACT_VERSION
225             default: $BUILD_ID
226             description: "Version number to append to resulting ISO."
227         - string:
228             name: SKIP_BUILD
229             default: 0
230             description: "Temporary parameter for deployment testing to skip the build and run deployment only."
231
232     scm:
233         - git:
234             skip-tag: true
235             url: $GIT_BASE
236             branches:
237                 - $GERRIT_BRANCH
238             refspec: $GERRIT_REFSPEC
239
240     triggers:
241         - pollscm: '@midnight'
242
243     logrotate:
244         daysToKeep: 30
245         numToKeep: 10
246         artifactDaysToKeep: -1
247         artifactNumToKeep: -1
248
249     builders:
250         - 'installer-build'
251         - 'installer-upload-artifact'
252         - 'installer-deploy-quick-fix'
253
254 - job-template:
255     name: 'genesis-fuel-build'
256
257     project-type: freestyle
258
259     disabled: true
260
261     node: ericsson-build
262
263     parameters:
264         - string:
265             name: GIT_BASE
266             default: https://gerrit.opnfv.org/gerrit/genesis
267             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
268         - string:
269             name: GERRIT_BRANCH
270             default: origin/master
271             description: "Branch to build, deploy and test."
272         - string:
273             name: GERRIT_REFSPEC
274             default: refs/heads/master
275             description: "Refspec to retrieve."
276         - string:
277             name: GS_URL
278             default: 'artifacts.opnfv.org/genesis/fuel'
279             description: "URL to Google Storage."
280         - string:
281             name: BUILD_DIRECTORY
282             default: $WORKSPACE/build_output
283             description: "Directory where the build artifact will be located upon the completion of the build."
284         - string:
285             name: CACHE_DIRECTORY
286             default: $HOME/opnfv/cache/genesis-fuel
287             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
288         - string:
289             name: ARTIFACT_VERSION
290             default: $BUILD_ID
291             description: "Version number to append to resulting ISO."
292         - string:
293             name: SKIP_BUILD
294             default: 0
295             description: "Temporary parameter for deployment testing to skip the build and run deployment only."
296
297     scm:
298         - git:
299             skip-tag: true
300             url: $GIT_BASE
301             branches:
302                 - $GERRIT_BRANCH
303             refspec: $GERRIT_REFSPEC
304
305     logrotate:
306         daysToKeep: 30
307         numToKeep: 10
308         artifactDaysToKeep: -1
309         artifactNumToKeep: -1
310
311     builders:
312         - shell: |
313             #!/bin/bash
314             set -o errexit
315             set -o nounset
316             set -o pipefail
317             set -x
318
319             echo "Hello World!"
320
321 - job-template:
322     name: 'genesis-fuel-deploy'
323
324     project-type: freestyle
325
326     disabled: true
327
328     node: opnfv-jump-1
329
330     parameters:
331         - string:
332             name: GIT_BASE
333             default: https://gerrit.opnfv.org/gerrit/genesis
334             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
335         - string:
336             name: GERRIT_BRANCH
337             default: origin/master
338             description: "Branch to build, deploy and test."
339         - string:
340             name: GERRIT_REFSPEC
341             default: refs/heads/master
342             description: "Refspec to retrieve."
343         - string:
344             name: GS_URL
345             default: 'artifacts.opnfv.org/genesis/fuel'
346             description: "URL to Google Storage."
347         - string:
348             name: BUILD_DIRECTORY
349             default: $WORKSPACE/build_output
350             description: "Directory where the build artifact will be located upon the completion of the build."
351         - string:
352             name: CACHE_DIRECTORY
353             default: $HOME/opnfv/cache/genesis-fuel
354             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
355         - string:
356             name: ARTIFACT_VERSION
357             default: $BUILD_ID
358             description: "Version number to append to resulting ISO."
359         - string:
360             name: SKIP_BUILD
361             default: 0
362             description: "Temporary parameter for deployment testing to skip the build and run deployment only."
363
364     scm:
365         - git:
366             skip-tag: true
367             url: $GIT_BASE
368             branches:
369                 - $GERRIT_BRANCH
370             refspec: $GERRIT_REFSPEC
371
372     logrotate:
373         daysToKeep: 30
374         numToKeep: 10
375         artifactDaysToKeep: -1
376         artifactNumToKeep: -1
377
378     builders:
379         - shell: |
380             #!/bin/bash
381             set -o errexit
382             set -o nounset
383             set -o pipefail
384             set -x
385
386             echo "Hello World!"
387
388 - job-template:
389     name: 'genesis-fuel-test'
390
391     project-type: freestyle
392
393     disabled: false
394
395     node: ericsson-test
396
397     parameters:
398         - string:
399             name: GIT_BASE
400             default: https://gerrit.opnfv.org/gerrit/genesis
401             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
402         - string:
403             name: GERRIT_BRANCH
404             default: origin/master
405             description: "Branch to build, deploy and test."
406         - string:
407             name: GERRIT_REFSPEC
408             default: refs/heads/master
409             description: "Refspec to retrieve."
410         - string:
411             name: GS_URL
412             default: 'artifacts.opnfv.org/genesis/fuel'
413             description: "URL to Google Storage."
414         - string:
415             name: BUILD_DIRECTORY
416             default: $WORKSPACE/build_output
417             description: "Directory where the build artifact will be located upon the completion of the build."
418         - string:
419             name: CACHE_DIRECTORY
420             default: $HOME/opnfv/cache/genesis-fuel
421             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
422         - string:
423             name: ARTIFACT_VERSION
424             default: $BUILD_ID
425             description: "Version number to append to resulting ISO."
426         - string:
427             name: SKIP_BUILD
428             default: 0
429             description: "Temporary parameter for deployment testing to skip the build and run deployment only."
430
431     scm:
432         - git:
433             skip-tag: true
434             url: $GIT_BASE
435             branches:
436                 - $GERRIT_BRANCH
437             refspec: $GERRIT_REFSPEC
438
439     logrotate:
440         daysToKeep: 30
441         numToKeep: 10
442         artifactDaysToKeep: -1
443         artifactNumToKeep: -1
444
445     builders:
446         - shell: |
447             #!/bin/bash
448             set -o errexit
449             set -o nounset
450             set -o pipefail
451             set -x
452
453             echo "Hello World!"
454
455 - builder:
456     name: installer-build
457     builders:
458         - shell: |
459             #!/bin/bash
460             set -o errexit
461             set -o nounset
462             set -o pipefail
463             set -x
464
465             # this is here for quick tries with deployment
466             SKIP_BUILD=${SKIP_BUILD-0}
467             if [ "$SKIP_BUILD" == "1" ]; then
468                 echo "Skipping build for deployment testing!"
469                 exit 0
470             else
471                 echo "Proceeding with build first!"
472             fi
473
474             # set/create the cache location
475             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
476
477             # do the build
478             cd $WORKSPACE/fuel/ci
479             ./build.sh -v $ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
480
481             # list the build artifacts
482             ls -al $BUILD_DIRECTORY
483
484 - builder:
485     name: installer-deploy-quick-fix
486     builders:
487         - shell: |
488             #!/bin/bash
489             set -o errexit
490             set -o nounset
491             set -o pipefail
492             set -x
493
494             # this is just a quick fix to execute the deployment in a messy way
495             # will be fixed later on
496             ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
497
498 - builder:
499     name: installer-test
500     builders:
501         - shell: |
502             #!/bin/bash
503             set -o errexit
504             set -o nounset
505             set -o pipefail
506             set -x
507
508             # run FuncTest
509             echo "Here is where we are supposed to run FuncTest"
510
511 - builder:
512     name: installer-upload-artifact
513     builders:
514         - shell: |
515             #!/bin/bash
516             set -o errexit
517             set -o nounset
518             set -o pipefail
519             set -x
520
521             # change the build directory where ISO is created
522             cd $BUILD_DIRECTORY
523
524             # save information regarding artifact into file
525             (
526                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
527                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
528                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$ARTIFACT_VERSION.iso"
529                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum opnfv-$ARTIFACT_VERSION.iso | cut -d' ' -f1)"
530                 echo "OPNFV_BUILD_URL=$BUILD_URL"
531                 echo "OPNFV_BUILD=OK"
532             ) > opnfv-$ARTIFACT_VERSION.properties
533
534             # copy artifact property file as latest.properties
535             # so we can directly get info regarding latest artifact
536             /bin/cp -f opnfv-$ARTIFACT_VERSION.properties latest.properties
537
538             # upload artifact and additional files to google storage
539             gsutil cp opnfv-$ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$ARTIFACT_VERSION.iso
540             gsutil cp opnfv-$ARTIFACT_VERSION.properties gs://$GS_URL/opnfv-$ARTIFACT_VERSION.properties
541             gsutil cp latest.properties gs://$GS_URL/latest.properties
542
543 - builder:
544     name: installer-download-artifact
545     builders:
546         - shell: |
547             #!/bin/bash
548             set -o errexit
549             set -o nounset
550             set -o pipefail
551             set -x
552
553             # get the latest.properties file in order to get info regarding latest artifact
554             gsutil cp gs://$GS_URL/latest.properties $WORKSPACE/latest.properties
555
556             # check if we got the file
557             [[ -f latest.properties ]] || exit 1
558
559             # source the file so we get OPNFV vars
560             source latest.properties
561
562             # download the file
563             gsutil cp gs://$OPNFV_ARTIFACT_URL $WORKSPACE/opnfv.iso
564
565             # list the file
566             ls -al $WORKSPACE/opnfv.iso
567
568 - builder:
569     name: installer-cleanup
570     builders:
571         - shell: |
572             #!/bin/bash
573             set -o errexit
574             set -o nounset
575             set -o pipefail
576             set -x
577
578             # delete everything that is in $WORKSPACE
579             /bin/rm -rf $WORKSPACE