9db53e617b381959e7a21ecdc28d2ebd1ca3c64f
[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             cd $WORKSPACE
404
405             ./deploy.sh $FLAVOR_CONF
406             if [ $? -ne 0 ]; then
407                 echo "depolyment failed!"
408                 deploy_ret=1
409             fi
410
411             echo
412             echo "--------------------------------------------------------"
413             echo "Done!"
414
415             ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
416             sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
417
418             exit $deploy_ret
419
420 - builder:
421     name: 'builder-compass-deploy-bare'
422     builders:
423         - shell: |
424             #!/bin/bash
425             set -x
426
427             # log info to console
428             echo "Starting the deployment on baremetal environment using $INSTALLER. This could take some time..."
429             echo "--------------------------------------------------------"
430             echo
431
432             export CONFDIR=$WORKSPACE/deploy/conf/hardware_environment/huawei_us_lab/pod1
433             export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
434             export EXTERNAL_NIC=eth0
435             export INSTALL_NIC=eth1
436
437             cd $WORKSPACE
438
439             ./deploy.sh --dha $CONFDIR/dha.yml --network $CONFDIR/network.yml
440             if [ $? -ne 0 ]; then
441                 echo "depolyment failed!"
442                 deploy_ret=1
443             fi
444
445             echo
446             echo "--------------------------------------------------------"
447             echo "Done!"
448
449             ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
450             sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
451
452             exit $deploy_ret
453
454 - builder:
455     name: 'builder-compass-upload-artifact'
456     builders:
457         - shell: |
458             #!/bin/bash
459             set -o errexit
460             set -o nounset
461             set -o pipefail
462
463             # log info to console
464             echo "Uploading the $INSTALLER artifact. This could take some time..."
465             echo "--------------------------------------------------------"
466             echo
467
468             # source the opnfv.properties to get ARTIFACT_VERSION
469             source $BUILD_DIRECTORY/opnfv.properties
470
471             # upload artifact and additional files to google storage
472             gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
473             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
474             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
475
476             echo
477             echo "--------------------------------------------------------"
478             echo "Done!"
479             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
480
481 - builder:
482     name: 'builder-compass-download-artifact'
483     builders:
484         - shell: |
485             #!/bin/bash
486             set -o errexit
487             set -o nounset
488             set -o pipefail
489
490             # log info to console
491             echo "Downloading the $INSTALLER artifact. This could take some time..."
492             echo "--------------------------------------------------------"
493             echo
494
495             # get the latest.properties file in order to get info regarding latest artifact
496             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
497             curl -s -o $BUILD_DIRECTORY/latest.properties http://$GS_URL/latest.properties
498
499             # check if we got the file
500             [[ -f $BUILD_DIRECTORY/latest.properties ]] || exit 1
501
502             # source the file so we get OPNFV vars
503             source $BUILD_DIRECTORY/latest.properties
504
505             # download the file
506             curl -s -o $BUILD_DIRECTORY/compass.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
507
508             # list the file
509             ls -al $BUILD_DIRECTORY/compass.iso
510
511             echo
512             echo "--------------------------------------------------------"
513             echo "Done!"
514
515 - builder:
516     name: 'builder-compass-workspace-cleanup'
517     builders:
518         - shell: |
519             #!/bin/bash
520             set -o errexit
521             set -o nounset
522             set -o pipefail
523
524             # delete everything that is in $WORKSPACE
525             /bin/rm -rf $WORKSPACE
526
527 - builder:
528     name: 'builder-compass-ci-preclean-workspace'
529     builders:
530         - shell: |
531             #!/bin/bash
532             set -o errexit
533             set -o nounset
534             set -o pipefail
535
536             cd $WORKSPACE/..
537             sudo rm $WORKSPACE -rf
538             git clone $GIT_BASE  $WORKSPACE
539