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