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