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