9065da972e9a18613ac3c86fc006fee666509575
[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-merge'
11         - 'genesis-compass-daily-{stream}'
12         - 'genesis-compass-deploy-virtual-{flavor}'
13
14     # stream:    branch with - in place of / (eg. stable-helium)
15     # branch:    branch (eg. stable/helium)
16     stream:
17         - master:
18             branch: 'master'
19
20     flavor:
21         - five:
22             conf: 'five'
23             node: 'compass-build-deploy-02'
24         - cluster:
25             conf: 'cluster'
26             node: 'compass-build-deploy-03'
27
28
29
30     project: 'genesis'
31
32 ########################
33 # job templates
34 ########################
35
36 - job-template:
37     name: 'genesis-compass-verify'
38
39     project-type: freestyle
40
41     disabled: true
42
43     node: compass-build-deploy-03
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         - gerrit-parameter:
55             branch: 'master'
56         - compass-parameter:
57             installer: '{installer}'
58
59     scm:
60         - gerrit-trigger-scm:
61             credentials-id: '{ssh-credentials}'
62             refspec: '$GERRIT_REFSPEC'
63             choosing-strategy: 'gerrit'
64
65     wrappers:
66         - ssh-agent-credentials:
67             user: '{ssh-credentials}'
68
69     triggers:
70         - gerrit:
71             trigger-on:
72                 - patchset-created-event:
73                     exclude-drafts: 'false'
74                     exclude-trivial-rebase: 'false'
75                     exclude-no-code-change: 'false'
76                 - draft-published-event
77                 - comment-added-contains-event:
78                     comment-contains-value: 'recheck'
79                 - comment-added-contains-event:
80                     comment-contains-value: 'reverify'
81             projects:
82               - project-compare-type: 'ANT'
83                 project-pattern: 'genesis'
84                 branches:
85                   - branch-compare-type: 'ANT'
86                     branch-pattern: '**/master'
87                 file-paths:
88                   - compare-type: ANT
89                     pattern: 'common/**'
90                   - compare-type: ANT
91                     pattern: 'compass/**'
92
93
94     builders:
95         - 'compass-build'
96         #- 'compass-workspace-cleanup'
97
98 - job-template:
99     name: 'genesis-compass-merge'
100
101     # builder-merge job to run JJB update
102     #
103     # This job's purpose is to update all the JJB
104
105     project-type: freestyle
106
107     node: compass-build-deploy-03
108
109     logrotate:
110         daysToKeep: 30
111         numToKeep: 40
112         artifactDaysToKeep: -1
113         artifactNumToKeep: 5
114
115     parameters:
116         - project-parameter:
117             project: '{project}'
118         - gerrit-parameter:
119             branch: 'master'
120         - compass-parameter:
121             installer: '{installer}'
122     scm:
123         - gerrit-trigger-scm:
124             credentials-id: '{ssh-credentials}'
125             refspec: ''
126             choosing-strategy: 'default'
127
128     wrappers:
129         - ssh-agent-credentials:
130             user: '{ssh-credentials}'
131
132     triggers:
133         - gerrit:
134             trigger-on:
135                 - change-merged-event
136                 - comment-added-contains-event:
137                     comment-contains-value: 'remerge'
138             projects:
139               - project-compare-type: 'ANT'
140                 project-pattern: 'genesis'
141                 branches:
142                     - branch-compare-type: 'ANT'
143                       branch-pattern: '**/master'
144                 file-paths:
145                   - compare-type: ANT
146                     pattern: 'common/**'
147                   - compare-type: ANT
148                     pattern: 'compass/**'
149
150     builders:
151         - 'compass-merge'
152
153 - job-template:
154     name: 'genesis-compass-daily-{stream}'
155
156     project-type: freestyle
157
158     node: compass-build-deploy-03
159
160     parameters:
161         - project-parameter:
162             project: '{project}'
163         - compass-parameter:
164             installer: '{installer}'
165
166     scm:
167         - git-scm:
168             credentials-id: '{ssh-credentials}'
169             refspec: ''
170             branch: '{branch}'
171
172     triggers:
173         - pollscm: '@midnight'
174
175     logrotate:
176         daysToKeep: 30
177         numToKeep: 10
178         artifactDaysToKeep: -1
179         artifactNumToKeep: -1
180
181     builders:
182         #- 'compass-build'
183         #- 'compass-upload-artifact'
184         #- 'compass-workspace-cleanup'
185         - shell: |
186             echo "Hello world!"
187             echo "genesis-compass-deploy-virtual job will be triggered!"
188
189     publishers:
190         - trigger:
191             project: 'genesis-compass-deploy-virtual-five'
192             threshold: SUCCESS
193         - trigger:
194             project: 'genesis-compass-deploy-virtual-cluster'
195             threshold: SUCCESS
196
197
198 - job-template:
199     name: 'genesis-compass-deploy-virtual-{flavor}'
200
201     project-type: freestyle
202
203     disabled: false
204
205     node: '{node}'
206
207     parameters:
208         - project-parameter:
209             project: '{project}'
210         - compass-parameter:
211             installer: '{installer}'
212         - string:
213             name: FLAVOR_CONF
214             default: '{conf}'
215             description: ""
216
217     triggers:
218         - pollscm: "H/2 * * * *"
219
220     logrotate:
221         daysToKeep: 30
222         numToKeep: 10
223         artifactDaysToKeep: -1
224         artifactNumToKeep: -1
225
226     builders:
227         - 'compass-ci-preclean-workspace'
228         - 'compass-deploy-virtual-flavor'
229
230 ########################
231 # parameter macros
232 ########################
233 - parameter:
234     name: compass-parameter
235     parameters:
236         - string:
237             name: INSTALLER
238             default: '{installer}'
239             description: "Installer to use."
240         - string:
241             name: BUILD_DIRECTORY
242             default: $WORKSPACE/build_output
243             description: "Directory where the build artifact will be located upon the completion of the build."
244         - string:
245             name: CACHE_DIRECTORY
246             default: $HOME/opnfv/cache/genesis-$INSTALLER
247             description: "Directory where the cache to be used during the build is located."
248         - string:
249             name: GIT_BASE
250             default: https://gerrit.opnfv.org/gerrit/$PROJECT
251             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
252         - string:
253             name: GS_URL
254             default: artifacts.opnfv.org/$PROJECT/$INSTALLER
255             description: "URL to Google Storage."
256         - string:
257             name: INTERNAL_REPO
258             default: "root@192.168.121.12:~/kun/artifacts"
259             description: "Artifact Repository"
260 ########################
261 # builder macros
262 ########################
263
264
265 - builder:
266     name: compass-merge
267     builders:
268         - shell: |
269             #!/bin/bash
270             echo "Hello World!"
271
272
273 - builder:
274     name: 'compass-build'
275     builders:
276         - shell: |
277             #!/bin/bash
278             set -o errexit
279             set -o nounset
280             set -o pipefail
281
282             # log info to console
283             echo "Hello world!"
284
285 - builder:
286     name: 'compass-deploy'
287     builders:
288         - shell: |
289             #!/bin/bash
290             set -o errexit
291             set -o nounset
292             set -o pipefail
293
294             # log info to console
295             echo "Hello world!"
296
297 - builder:
298     name: 'compass-deploy-virtual-flavor'
299     builders:
300         - shell: |
301             #!/bin/bash
302             set -o errexit
303             set -o nounset
304             set -o pipefail
305
306             # log info to console
307             echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
308             echo "--------------------------------------------------------"
309             echo
310
311             cd $WORKSPACE/compass
312             ./ci/deploy.sh $FLAVOR_CONF
313             # ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
314
315             echo
316             echo "--------------------------------------------------------"
317             echo "Done!"
318
319 - builder:
320     name: 'compass-upload-artifact'
321     builders:
322         - shell: |
323             #!/bin/bash
324             set -o errexit
325             set -o nounset
326             set -o pipefail
327
328             # log info to console
329             echo "Uploading the $INSTALLER artifact. This could take some time..."
330             echo "--------------------------------------------------------"
331             echo
332
333             # source the opnfv.properties to get ARTIFACT_VERSION
334             source $WORKSPACE/opnfv.properties
335
336             # upload artifact and additional files to google storage
337             gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
338             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
339             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
340
341             echo
342             echo "--------------------------------------------------------"
343             echo "Done!"
344
345 - builder:
346     name: 'compass-download-artifact'
347     builders:
348         - shell: |
349             #!/bin/bash
350             set -o errexit
351             set -o nounset
352             set -o pipefail
353
354             # log info to console
355             echo "Downloading the $INSTALLER artifact. This could take some time..."
356             echo "--------------------------------------------------------"
357             echo
358
359             # get the latest.properties file in order to get info regarding latest artifact
360             curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
361
362             # check if we got the file
363             [[ -f latest.properties ]] || exit 1
364
365             # source the file so we get OPNFV vars
366             source latest.properties
367
368             # download the file
369             curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
370
371             # list the file
372             ls -al $WORKSPACE/opnfv.iso
373
374             echo
375             echo "--------------------------------------------------------"
376             echo "Done!"
377
378 - builder:
379     name: 'compass-workspace-cleanup'
380     builders:
381         - shell: |
382             #!/bin/bash
383             set -o errexit
384             set -o nounset
385             set -o pipefail
386
387             # delete everything that is in $WORKSPACE
388             /bin/rm -rf $WORKSPACE
389
390 - builder:
391     name: 'compass-ci-preclean-workspace'
392     builders:
393         - shell: |
394             #!/bin/bash
395             set -o errexit
396             set -o nounset
397             set -o pipefail
398
399             cd $WORKSPACE/..
400             sudo rm $WORKSPACE -rf
401             git clone $GIT_BASE  $WORKSPACE
402