Merge "remove test_cases info in project description"
[releng.git] / jjb / compass4nfv / compass4nfv.yml
1 # this is the job configuration for bgs
2 - project:
3
4     name: compass
5
6     installer: 'compass'
7
8     jobs:
9         - 'compass-verify'
10         - 'compass-merge'
11         - 'compass-daily-{stream}'
12         - 'compass-build-iso'
13         - 'compass-build-ppa'
14         - 'compass-deploy-virtual-{flavor}'
15         - 'compass-deploy-bare-huawei-us'
16
17     # stream:    branch with - in place of / (eg. stable-helium)
18     # branch:    branch (eg. stable/helium)
19     stream:
20         - master:
21             branch: 'master'
22
23     flavor:
24         - cluster-odl:
25             conf: 'virtual_cluster_odl'
26             node: 'huawei-deploy-vm'
27         - cluster-onos:
28             conf: 'virtual_cluster_onos'
29             node: 'huawei-deploy-vm'
30         - cluster:
31             conf: 'virtual_cluster'
32             node: 'huawei-deploy-vm'
33
34     project: 'compass4nfv'
35
36 ########################
37 # job templates
38 ########################
39 - job-template:
40     name: 'compass-verify'
41
42     disabled: false
43
44     node: 'huawei-deploy-vm'
45
46     concurrent: true
47
48     properties:
49         - throttle:
50             enabled: true
51             max-total: 3
52             max-per-node: 1
53
54     logrotate:
55         daysToKeep: 30
56         numToKeep: 10
57         artifactDaysToKeep: -1
58         artifactNumToKeep: -1
59
60     parameters:
61         - project-parameter:
62             project: '{project}'
63         - gerrit-parameter:
64             branch: 'master'
65         - compass-parameter:
66             installer: '{installer}'
67         - string:
68             name: FLAVOR_CONF
69             default: 'virtual_cluster'
70             description: ""
71     scm:
72         - gerrit-trigger-scm:
73             credentials-id: '{ssh-credentials}'
74             refspec: '$GERRIT_REFSPEC'
75             choosing-strategy: 'gerrit'
76
77     triggers:
78         - gerrit:
79             trigger-on:
80                 - patchset-created-event:
81                     exclude-drafts: 'false'
82                     exclude-trivial-rebase: 'false'
83                     exclude-no-code-change: 'false'
84                 - draft-published-event
85                 - comment-added-contains-event:
86                     comment-contains-value: 'recheck'
87                 - comment-added-contains-event:
88                     comment-contains-value: 'reverify'
89             projects:
90               - project-compare-type: 'ANT'
91                 project-pattern: '{project}'
92                 branches:
93                   - branch-compare-type: 'ANT'
94                     branch-pattern: '**/master'
95                 forbidden-file-paths:
96                   - compare-type: ANT
97                     pattern: 'docs/**'
98
99     builders:
100         - 'builder-compass-build-iso'
101         - 'builder-compass-deploy-virtual-flavor'
102     publishers:
103         - archive:
104             artifacts: 'ansible.log'
105             allow-empty: 'true'
106             fingerprint: true
107
108 - job-template:
109     name: 'compass-merge'
110
111     # builder-merge job to run JJB update
112     #
113     # This job's purpose is to update all the JJB
114
115     node: huawei-build
116
117     concurrent: true
118
119     properties:
120         - throttle:
121             enabled: true
122             max-total: 3
123             max-per-node: 1
124
125     parameters:
126         - project-parameter:
127             project: '{project}'
128         - gerrit-parameter:
129             branch: 'master'
130         - compass-parameter:
131             installer: '{installer}'
132
133     scm:
134         - gerrit-trigger-scm:
135             credentials-id: '{ssh-credentials}'
136             refspec: ''
137             choosing-strategy: 'default'
138
139     triggers:
140         - gerrit:
141             trigger-on:
142                 - change-merged-event
143                 - comment-added-contains-event:
144                     comment-contains-value: 'remerge'
145             projects:
146               - project-compare-type: 'ANT'
147                 project-pattern: '{project}'
148                 branches:
149                     - branch-compare-type: 'ANT'
150                       branch-pattern: '**/master'
151
152     builders:
153         - 'builder-compass-merge'
154
155 - job-template:
156     name: 'compass-daily-{stream}'
157
158     node: huawei-build
159
160     concurrent: true
161
162     properties:
163         - throttle:
164             enabled: true
165             max-total: 1
166             max-per-node: 1
167
168     parameters:
169         - project-parameter:
170             project: '{project}'
171         - compass-parameter:
172             installer: '{installer}'
173
174     scm:
175         - git-scm:
176             credentials-id: '{ssh-credentials}'
177             refspec: ''
178             branch: '{branch}'
179
180     triggers:
181         - timed: '@midnight'
182
183     logrotate:
184         daysToKeep: 30
185         numToKeep: 10
186         artifactDaysToKeep: -1
187         artifactNumToKeep: -1
188
189     builders:
190         - trigger-builds:
191           - project: 'compass-build-iso'
192             git-revision: true
193             block: true
194         - trigger-builds:
195           - project: 'compass-deploy-virtual-cluster'
196             git-revision: true
197             block: true
198 #        - trigger-builds:
199 #          - project: 'compass-deploy-virtual-cluster-odl'
200 #            git-revision: true
201 #            block: true
202         - trigger-builds:
203           - project: 'compass-deploy-virtual-cluster-onos'
204             git-revision: true
205             block: true
206
207 - job-template:
208     name: 'compass-build-iso'
209
210     node: ericsson-build
211
212     concurrent: true
213
214     properties:
215         - throttle:
216             enabled: true
217             max-total: 1
218             max-per-node: 1
219
220     logrotate:
221         daysToKeep: 30
222         numToKeep: 10
223         artifactDaysToKeep: -1
224         artifactNumToKeep: -1
225
226     parameters:
227         - project-parameter:
228             project: '{project}'
229         - compass-parameter:
230             installer: '{installer}'
231
232     scm:
233         - git-scm:
234             credentials-id: '{ssh-credentials}'
235             refspec: ''
236             branch: 'master'
237
238     builders:
239         - 'builder-compass-build-iso'
240         - 'builder-compass-upload-artifact'
241         - 'builder-compass-workspace-cleanup'
242
243 - job-template:
244     name: 'compass-build-ppa'
245
246     description: "build ppa(using docker) in huawei lab"
247
248     node: huawei-build
249
250     concurrent: true
251
252     properties:
253         - throttle:
254             enabled: true
255             max-total: 1
256             max-per-node: 1
257
258     logrotate:
259         daysToKeep: 30
260         numToKeep: 10
261         artifactDaysToKeep: -1
262         artifactNumToKeep: -1
263
264     parameters:
265         - project-parameter:
266             project: '{project}'
267         - compass-parameter:
268             installer: '{installer}'
269
270     scm:
271         - git-scm:
272             credentials-id: '{ssh-credentials}'
273             refspec: ''
274             branch: 'master'
275
276     triggers:
277         - timed: 'H 16 * * *'
278
279     builders:
280         - 'builder-compass-make-ppa'
281
282 - job-template:
283     name: 'compass-deploy-virtual-{flavor}'
284
285     disabled: false
286
287     node: '{node}'
288
289     concurrent: true
290
291     properties:
292         - throttle:
293             enabled: true
294             max-total: 1
295             max-per-node: 1
296
297     parameters:
298         - project-parameter:
299             project: '{project}'
300         - compass-parameter:
301             installer: '{installer}'
302         - string:
303             name: FLAVOR_CONF
304             default: '{conf}'
305             description: ""
306
307     logrotate:
308         daysToKeep: 30
309         numToKeep: 10
310         artifactDaysToKeep: -1
311         artifactNumToKeep: -1
312
313     builders:
314         - 'builder-compass-ci-preclean-workspace'
315         - 'builder-compass-download-artifact'
316         - 'builder-compass-deploy-virtual-flavor'
317     publishers:
318         - archive:
319             artifacts: 'ansible.log'
320             allow-empty: 'true'
321             fingerprint: true
322
323 - job-template:
324     name: 'compass-deploy-bare-huawei-us'
325
326     disabled: false
327
328     node: 'huawei-us-deploy-bare-1'
329
330     concurrent: true
331
332     properties:
333         - throttle:
334             enabled: true
335             max-total: 1
336             max-per-node: 1
337
338     parameters:
339         - project-parameter:
340             project: '{project}'
341         - compass-parameter:
342             installer: '{installer}'
343
344     logrotate:
345         daysToKeep: 30
346         numToKeep: 10
347         artifactDaysToKeep: -1
348         artifactNumToKeep: -1
349
350     builders:
351         - 'builder-compass-ci-preclean-workspace'
352         - 'builder-compass-download-artifact'
353         - 'builder-compass-deploy-bare'
354
355     publishers:
356         - archive:
357             artifacts: 'ansible.log'
358             allow-empty: 'true'
359             fingerprint: true
360
361 ########################
362 # parameter macros
363 ########################
364 - parameter:
365     name: compass-parameter
366     parameters:
367         - string:
368             name: INSTALLER
369             default: '{installer}'
370             description: "Installer to use."
371         - string:
372             name: BUILD_DIRECTORY
373             default: $WORKSPACE/build_output
374             description: "Directory where the build artifact will be located upon the completion of the build."
375         - string:
376             name: CACHE_DIRECTORY
377             default: $HOME/opnfv/cache/$PROJECT
378             description: "Directory where the cache to be used during the build is located."
379         - string:
380             name: GIT_BASE
381             default: https://gerrit.opnfv.org/gerrit/$PROJECT
382             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
383         - string:
384             name: GS_URL
385             default: artifacts.opnfv.org/$PROJECT/
386             description: "URL to Google Storage."
387         - string:
388             name: GS_URL_PROXY
389             default: build.opnfv.org/artifacts/$PROJECT/
390             description: "URL to Google Storage proxy"
391         - string:
392             name: installer_ip
393             default: "192.168.200.2"
394         - string:
395             name: PPA_REPO
396             default: "http://205.177.226.235:9999"
397         - string:
398             name: PPA_CACHE
399             default: "$WORKSPACE/work/repo/"
400
401 ########################
402 # builder macros
403 ########################
404 - builder:
405     name: 'builder-compass-merge'
406     builders:
407         - shell: |
408             #!/bin/bash
409             echo "Hello World!"
410
411 - builder:
412     name: 'builder-compass-make-ppa'
413     builders:
414         - shell: |
415             #!/bin/bash
416             set -x
417             set -o errexit
418             set -o nounset
419             set -o pipefail
420             # make ppa
421             cd $WORKSPACE/
422             ./build/make_repo.sh
423             # calc MD5 of ppa
424             cd $PPA_CACHE
425             for i in $(find *.gz *.iso *.img -type f)
426             do
427                 md5=$(md5sum $i | cut -d ' ' -f1)
428                 echo $md5 > $i.md5
429                 curl -T $i $PPA_REPO
430                 curl -T $i.md5 $PPA_REPO
431             done
432
433 - builder:
434     name: 'builder-compass-build-iso'
435     builders:
436         - shell: |
437             #!/bin/bash
438             set -o errexit
439             set -o nounset
440             set -o pipefail
441
442             # log info to console
443             echo "Starting the build of $INSTALLER. This could take some time..."
444             echo "--------------------------------------------------------"
445             echo
446
447             # create the cache directory if it doesn't exist
448             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
449             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
450
451             # set OPNFV_ARTIFACT_VERSION
452             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
453
454             # start the build
455             if [ -d $PPA_CACHE ]
456             then
457                 cp $PPA_CACHE/*.tar.gz $PPA_CACHE/*.iso $PPA_CACHE/*.img $CACHE_DIRECTORY/ -f
458             fi
459
460             cd $WORKSPACE/
461             ./build.sh  --iso-dir $BUILD_DIRECTORY/ --iso-name compass.iso -c $CACHE_DIRECTORY
462
463             # list the build artifacts
464             ls -al $BUILD_DIRECTORY
465
466             # save information regarding artifact into file
467             (
468                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
469                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
470                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
471                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
472                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)"
473                 echo "OPNFV_BUILD_URL=$BUILD_URL"
474             ) > $BUILD_DIRECTORY/opnfv.properties
475             echo
476             echo "--------------------------------------------------------"
477             echo "Done!"
478
479 - builder:
480     name: 'builder-compass-deploy-virtual-flavor'
481     builders:
482         - shell: |
483             #!/bin/bash
484             set -x
485
486             # log info to console
487             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
488             echo "--------------------------------------------------------"
489             echo
490
491             export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
492             cd $WORKSPACE
493
494             ./deploy.sh $FLAVOR_CONF
495             if [ $? -ne 0 ]; then
496                 echo "depolyment failed!"
497                 deploy_ret=1
498             fi
499
500             echo
501             echo "--------------------------------------------------------"
502             echo "Done!"
503
504             ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
505             sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
506
507             exit $deploy_ret
508
509 - builder:
510     name: 'builder-compass-deploy-bare'
511     builders:
512         - shell: |
513             #!/bin/bash
514             set -x
515
516             # log info to console
517             echo "Starting the deployment on baremetal environment using $INSTALLER. This could take some time..."
518             echo "--------------------------------------------------------"
519             echo
520
521             export CONFDIR=$WORKSPACE/deploy/conf/hardware_environment/huawei_us_lab/pod1
522             export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
523             export EXTERNAL_NIC=eth0
524             export INSTALL_NIC=eth1
525
526             cd $WORKSPACE
527
528             ./deploy.sh --dha $CONFDIR/dha.yml --network $CONFDIR/network.yml
529             if [ $? -ne 0 ]; then
530                 echo "depolyment failed!"
531                 deploy_ret=1
532             fi
533
534             echo
535             echo "--------------------------------------------------------"
536             echo "Done!"
537
538             ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
539             sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
540
541             exit $deploy_ret
542
543 - builder:
544     name: 'builder-compass-upload-artifact'
545     builders:
546         - shell: |
547             #!/bin/bash
548             set -o errexit
549             set -o nounset
550             set -o pipefail
551
552             # log info to console
553             echo "Uploading the $INSTALLER artifact. This could take some time..."
554             echo "--------------------------------------------------------"
555             echo
556
557             # source the opnfv.properties to get ARTIFACT_VERSION
558             source $BUILD_DIRECTORY/opnfv.properties
559
560             # upload artifact and additional files to google storage
561             gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
562             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
563             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
564
565             echo
566             echo "--------------------------------------------------------"
567             echo "Done!"
568             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
569
570 - builder:
571     name: 'builder-compass-download-artifact'
572     builders:
573         - shell: |
574             #!/bin/bash
575             set -o errexit
576             set -o nounset
577             set -o pipefail
578
579             # log info to console
580             echo "Downloading the $INSTALLER artifact. This could take some time..."
581             echo "--------------------------------------------------------"
582             echo
583
584             # get the latest.properties file in order to get info regarding latest artifact
585             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
586             curl -s -o $BUILD_DIRECTORY/latest.properties http://$GS_URL/latest.properties
587
588             # check if we got the file
589             [[ -f $BUILD_DIRECTORY/latest.properties ]] || exit 1
590
591             # source the file so we get OPNFV vars
592             source $BUILD_DIRECTORY/latest.properties
593
594             # download the file
595             curl -s -o $BUILD_DIRECTORY/compass.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
596
597             # list the file
598             ls -al $BUILD_DIRECTORY/compass.iso
599
600             echo
601             echo "--------------------------------------------------------"
602             echo "Done!"
603
604 - builder:
605     name: 'builder-compass-workspace-cleanup'
606     builders:
607         - shell: |
608             #!/bin/bash
609             set -o errexit
610             set -o nounset
611             set -o pipefail
612
613             # delete everything that is in $WORKSPACE
614             /bin/rm -rf $WORKSPACE
615
616 - builder:
617     name: 'builder-compass-ci-preclean-workspace'
618     builders:
619         - shell: |
620             #!/bin/bash
621             set -o errexit
622             set -o nounset
623             set -o pipefail
624
625             cd $WORKSPACE/..
626             sudo rm $WORKSPACE -rf
627             git clone $GIT_BASE  $WORKSPACE
628