the workaround of network configuration
[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'
11         - 'compass-build-ppa'
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 #        - stable-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: 'master'
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: '**/master'
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'
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'
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: 'master'
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'
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: 'master'
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
319 ########################
320 # builder macros
321 ########################
322 - builder:
323     name: 'builder-compass-make-ppa'
324     builders:
325         - shell: |
326             #!/bin/bash
327             set -x
328             set -o errexit
329             set -o nounset
330             set -o pipefail
331             # make ppa
332             cd $WORKSPACE/
333             ./build/make_repo.sh
334             # calc MD5 of ppa
335             cd $PPA_CACHE
336             for i in $(find *.gz *.iso *.img -type f)
337             do
338                 md5=$(md5sum $i | cut -d ' ' -f1)
339                 echo $md5 > $i.md5
340                 curl -T $i $PPA_REPO
341                 curl -T $i.md5 $PPA_REPO
342             done
343
344 - builder:
345     name: 'builder-compass-build-iso'
346     builders:
347         - shell: |
348             #!/bin/bash
349             set -o errexit
350             set -o nounset
351             set -o pipefail
352
353             # log info to console
354             echo "Starting the build of $INSTALLER. This could take some time..."
355             echo "--------------------------------------------------------"
356             echo
357
358             # create the cache directory if it doesn't exist
359             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
360             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
361
362             # set OPNFV_ARTIFACT_VERSION
363             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
364
365             # start the build
366             if [ -d $PPA_CACHE ]
367             then
368                 cp $PPA_CACHE/*.tar.gz $PPA_CACHE/*.iso $PPA_CACHE/*.img $CACHE_DIRECTORY/ -f
369             fi
370
371             cd $WORKSPACE/
372             ./build.sh  --iso-dir $BUILD_DIRECTORY/ --iso-name compass.iso -c $CACHE_DIRECTORY
373
374             # list the build artifacts
375             ls -al $BUILD_DIRECTORY
376
377             # save information regarding artifact into file
378             (
379                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
380                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
381                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
382                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
383                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)"
384                 echo "OPNFV_BUILD_URL=$BUILD_URL"
385             ) > $BUILD_DIRECTORY/opnfv.properties
386             echo
387             echo "--------------------------------------------------------"
388             echo "Done!"
389
390 - builder:
391     name: 'builder-compass-deploy-virtual-flavor'
392     builders:
393         - shell: |
394             #!/bin/bash
395             set -x
396
397             # log info to console
398             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
399             echo "--------------------------------------------------------"
400             echo
401
402             export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
403             brctl addbr vnic_ci
404             ifconfig vnic_ci up
405             export EXTERNAL_NIC=vnic_ci
406             cd $WORKSPACE
407
408             ./deploy.sh $FLAVOR_CONF
409             if [ $? -ne 0 ]; then
410                 echo "depolyment failed!"
411                 deploy_ret=1
412             fi
413
414             echo
415             echo "--------------------------------------------------------"
416             echo "Done!"
417
418             ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
419             sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
420
421             exit $deploy_ret
422
423 - builder:
424     name: 'builder-compass-deploy-bare'
425     builders:
426         - shell: |
427             #!/bin/bash
428             set -x
429
430             # log info to console
431             echo "Starting the deployment on baremetal environment using $INSTALLER. This could take some time..."
432             echo "--------------------------------------------------------"
433             echo
434
435             export CONFDIR=$WORKSPACE/deploy/conf/hardware_environment/huawei_us_lab/pod1
436             export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
437             export EXTERNAL_NIC=eth0
438             export INSTALL_NIC=eth1
439
440             cd $WORKSPACE
441
442             ./deploy.sh --dha $CONFDIR/dha.yml --network $CONFDIR/network.yml
443             if [ $? -ne 0 ]; then
444                 echo "depolyment failed!"
445                 deploy_ret=1
446             fi
447
448             echo
449             echo "--------------------------------------------------------"
450             echo "Done!"
451
452             ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
453             sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
454
455             exit $deploy_ret
456
457 - builder:
458     name: 'builder-compass-upload-artifact'
459     builders:
460         - shell: |
461             #!/bin/bash
462             set -o errexit
463             set -o nounset
464             set -o pipefail
465
466             # log info to console
467             echo "Uploading the $INSTALLER artifact. This could take some time..."
468             echo "--------------------------------------------------------"
469             echo
470
471             # source the opnfv.properties to get ARTIFACT_VERSION
472             source $BUILD_DIRECTORY/opnfv.properties
473
474             # upload artifact and additional files to google storage
475             gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
476             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
477             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
478
479             echo
480             echo "--------------------------------------------------------"
481             echo "Done!"
482             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
483
484 - builder:
485     name: 'builder-compass-download-artifact'
486     builders:
487         - shell: |
488             #!/bin/bash
489             set -o errexit
490             set -o nounset
491             set -o pipefail
492
493             # log info to console
494             echo "Downloading the $INSTALLER artifact. This could take some time..."
495             echo "--------------------------------------------------------"
496             echo
497
498             # get the latest.properties file in order to get info regarding latest artifact
499             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
500             curl -s -o $BUILD_DIRECTORY/latest.properties http://$GS_URL/latest.properties
501
502             # check if we got the file
503             [[ -f $BUILD_DIRECTORY/latest.properties ]] || exit 1
504
505             # source the file so we get OPNFV vars
506             source $BUILD_DIRECTORY/latest.properties
507
508             # download the file
509             curl -s -o $BUILD_DIRECTORY/compass.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
510
511             # list the file
512             ls -al $BUILD_DIRECTORY/compass.iso
513
514             echo
515             echo "--------------------------------------------------------"
516             echo "Done!"
517
518 - builder:
519     name: 'builder-compass-workspace-cleanup'
520     builders:
521         - shell: |
522             #!/bin/bash
523             set -o errexit
524             set -o nounset
525             set -o pipefail
526
527             # delete everything that is in $WORKSPACE
528             /bin/rm -rf $WORKSPACE
529
530 - builder:
531     name: 'builder-compass-ci-preclean-workspace'
532     builders:
533         - shell: |
534             #!/bin/bash
535             set -o errexit
536             set -o nounset
537             set -o pipefail
538
539             cd $WORKSPACE/..
540             sudo rm $WORKSPACE -rf
541             git clone $GIT_BASE  $WORKSPACE
542