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