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