[compass] fix the GS_URL for B release branch
[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}-{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     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             gs-pathname: '{gs-pathname}'
63         - string:
64             name: FLAVOR_CONF
65             default: 'virtual_cluster'
66             description: ""
67     scm:
68         - gerrit-trigger-scm:
69             credentials-id: '{ssh-credentials}'
70             refspec: '$GERRIT_REFSPEC'
71             choosing-strategy: 'gerrit'
72
73     triggers:
74         - gerrit:
75             trigger-on:
76                 - patchset-created-event:
77                     exclude-drafts: 'false'
78                     exclude-trivial-rebase: 'false'
79                     exclude-no-code-change: 'false'
80                 - draft-published-event
81                 - comment-added-contains-event:
82                     comment-contains-value: 'recheck'
83                 - comment-added-contains-event:
84                     comment-contains-value: 'reverify'
85             projects:
86               - project-compare-type: 'ANT'
87                 project-pattern: '{project}'
88                 branches:
89                   - branch-compare-type: 'ANT'
90                     branch-pattern: '**/{branch}'
91                 forbidden-file-paths:
92                   - compare-type: ANT
93                     pattern: 'docs/**|.gitignore'
94
95     builders:
96         - 'builder-compass-build-iso'
97         - 'builder-compass-deploy-virtual-flavor'
98     publishers:
99         - archive:
100             artifacts: 'ansible.log'
101             allow-empty: 'true'
102             fingerprint: true
103
104 - job-template:
105     name: 'compass-daily-{stream}'
106
107     node: huawei-build
108
109     concurrent: true
110
111     properties:
112         - throttle:
113             enabled: true
114             max-total: 1
115             max-per-node: 1
116
117     parameters:
118         - project-parameter:
119             project: '{project}'
120         - compass-parameter:
121             installer: '{installer}'
122             gs-pathname: '{gs-pathname}'
123
124     scm:
125         - git-scm:
126             credentials-id: '{ssh-credentials}'
127             refspec: ''
128             branch: '{branch}'
129
130     triggers:
131         - timed: 'H 16 * * *'
132
133     builders:
134         - trigger-builds:
135           - project: 'compass-build-iso-{stream}'
136             git-revision: true
137             block: true
138         - trigger-builds:
139           - project: 'compass-deploy-virtual-cluster-{stream}'
140             git-revision: true
141             block: true
142         - trigger-builds:
143           - project: 'compass-deploy-virtual-cluster-odl-{stream}'
144             git-revision: true
145             block: true
146         - trigger-builds:
147           - project: 'compass-deploy-virtual-cluster-onos-{stream}'
148             git-revision: true
149             block: true
150         - trigger-builds:
151           - project: 'compass-deploy-bare-huawei-us-{stream}'
152             git-revision: true
153             block: true
154
155
156 - job-template:
157     name: 'compass-build-iso-{stream}'
158
159     node: ericsson-build
160
161     concurrent: true
162
163     properties:
164         - throttle:
165             enabled: true
166             max-total: 1
167             max-per-node: 1
168
169     parameters:
170         - project-parameter:
171             project: '{project}'
172         - compass-parameter:
173             installer: '{installer}'
174             gs-pathname: '{gs-pathname}'
175
176     scm:
177         - git-scm:
178             credentials-id: '{ssh-credentials}'
179             refspec: ''
180             branch: '{branch}'
181
182     builders:
183         - 'builder-compass-build-iso'
184         - 'builder-compass-upload-artifact'
185         - 'builder-compass-workspace-cleanup'
186
187 - job-template:
188     name: 'compass-build-ppa-{stream}'
189
190     description: "build ppa(using docker) in huawei lab"
191
192     node: huawei-build
193
194     concurrent: true
195
196     properties:
197         - throttle:
198             enabled: true
199             max-total: 1
200             max-per-node: 1
201
202     parameters:
203         - project-parameter:
204             project: '{project}'
205         - compass-parameter:
206             installer: '{installer}'
207             gs-pathname: '{gs-pathname}'
208
209     scm:
210         - git-scm:
211             credentials-id: '{ssh-credentials}'
212             refspec: ''
213             branch: '{branch}'
214
215     triggers:
216         - timed: 'H 16 * * *'
217
218     builders:
219         - 'builder-compass-make-ppa'
220
221 - job-template:
222     name: 'compass-deploy-virtual-{flavor}-{stream}'
223
224     disabled: false
225
226     node: '{node}'
227
228     concurrent: true
229
230     properties:
231         - throttle:
232             enabled: true
233             max-total: 1
234             max-per-node: 1
235
236     parameters:
237         - project-parameter:
238             project: '{project}'
239         - compass-parameter:
240             installer: '{installer}'
241             gs-pathname: '{gs-pathname}'
242         - string:
243             name: FLAVOR_CONF
244             default: '{conf}'
245             description: ""
246
247     builders:
248         - 'builder-compass-ci-preclean-workspace'
249         - 'builder-compass-download-artifact'
250         - 'builder-compass-deploy-virtual-flavor'
251     publishers:
252         - archive:
253             artifacts: 'ansible.log'
254             allow-empty: 'true'
255             fingerprint: true
256
257 - job-template:
258     name: 'compass-deploy-bare-huawei-us-{stream}'
259
260     disabled: false
261
262     node: 'huawei-us-deploy-bare-1'
263
264     concurrent: true
265
266     properties:
267         - throttle:
268             enabled: true
269             max-total: 1
270             max-per-node: 1
271
272     parameters:
273         - project-parameter:
274             project: '{project}'
275         - compass-parameter:
276             installer: '{installer}'
277             gs-pathname: '{gs-pathname}'
278
279     builders:
280         - 'builder-compass-ci-preclean-workspace'
281         - 'builder-compass-download-artifact'
282         - 'builder-compass-deploy-bare'
283
284     publishers:
285         - archive:
286             artifacts: 'ansible.log'
287             allow-empty: 'true'
288             fingerprint: true
289
290 ########################
291 # parameter macros
292 ########################
293 - parameter:
294     name: compass-parameter
295     parameters:
296         - string:
297             name: INSTALLER
298             default: '{installer}'
299             description: "Installer to use."
300         - string:
301             name: BUILD_DIRECTORY
302             default: $WORKSPACE/build_output
303             description: "Directory where the build artifact will be located upon the completion of the build."
304         - string:
305             name: CACHE_DIRECTORY
306             default: $HOME/opnfv/cache/$PROJECT
307             description: "Directory where the cache to be used during the build is located."
308         - string:
309             name: GIT_BASE
310             default: https://gerrit.opnfv.org/gerrit/$PROJECT
311             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
312         - string:
313             name: GS_URL
314             default: artifacts.opnfv.org/$PROJECT{gs-pathname}
315             description: "URL to Google Storage."
316         - string:
317             name: GS_URL_PROXY
318             default: build.opnfv.org/artifacts/$PROJECT/
319             description: "URL to Google Storage proxy"
320         - string:
321             name: installer_ip
322             default: "192.168.200.2"
323         - string:
324             name: PPA_REPO
325             default: "http://205.177.226.235:9999"
326         - string:
327             name: PPA_CACHE
328             default: "$WORKSPACE/work/repo/"
329         - choice:
330             name: COMPASS_OPENSTACK_VERSION
331             choices:
332                 - 'liberty'
333                 - 'juno'
334         - choice:
335             name: COMPASS_OS_VERSION
336             choices:
337                 - 'trusty'
338                 - 'centos7'
339
340 ########################
341 # builder macros
342 ########################
343 - builder:
344     name: 'builder-compass-make-ppa'
345     builders:
346         - shell: |
347             #!/bin/bash
348             set -x
349             set -o errexit
350             set -o nounset
351             set -o pipefail
352             # make ppa
353             cd $WORKSPACE/
354             ./build/make_repo.sh
355             # calc MD5 of ppa
356             cd $PPA_CACHE
357             for i in $(find *.gz *.iso *.img -type f)
358             do
359                 md5=$(md5sum $i | cut -d ' ' -f1)
360                 echo $md5 > $i.md5
361                 curl -T $i $PPA_REPO
362                 curl -T $i.md5 $PPA_REPO
363             done
364
365 - builder:
366     name: 'builder-compass-build-iso'
367     builders:
368         - shell: |
369             #!/bin/bash
370             set -o errexit
371             set -o nounset
372             set -o pipefail
373
374             # log info to console
375             echo "Starting the build of $INSTALLER. This could take some time..."
376             echo "--------------------------------------------------------"
377             echo
378
379             # create the cache directory if it doesn't exist
380             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
381             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
382
383             # set OPNFV_ARTIFACT_VERSION
384             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
385
386             # start the build
387             if [ -d $PPA_CACHE ]
388             then
389                 cp $PPA_CACHE/*.tar.gz $PPA_CACHE/*.iso $PPA_CACHE/*.img $CACHE_DIRECTORY/ -f
390             fi
391
392             cd $WORKSPACE/
393             ./build.sh  --iso-dir $BUILD_DIRECTORY/ --iso-name compass.iso -c $CACHE_DIRECTORY
394
395             # list the build artifacts
396             ls -al $BUILD_DIRECTORY
397
398             # save information regarding artifact into file
399             (
400                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
401                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
402                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
403                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
404                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)"
405                 echo "OPNFV_BUILD_URL=$BUILD_URL"
406             ) > $BUILD_DIRECTORY/opnfv.properties
407             echo
408             echo "--------------------------------------------------------"
409             echo "Done!"
410
411 - builder:
412     name: 'builder-compass-deploy-virtual-flavor'
413     builders:
414         - shell: |
415             #!/bin/bash
416             set -x
417
418             # log info to console
419             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
420             echo "--------------------------------------------------------"
421             echo
422
423             export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
424             sudo brctl addbr vnic_ci
425             sudo ifconfig vnic_ci up
426             export EXTERNAL_NIC=vnic_ci
427             cd $WORKSPACE
428
429             export OS_VERSION=${COMPASS_OS_VERSION}
430             export OPENSTACK_VERSION=${COMPASS_OPENSTACK_VERSION}
431             ./deploy.sh $FLAVOR_CONF
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