Disable fuel virtual deployment on Ericsson Lab
[releng.git] / jjb / genesis / genesis-foreman.yml
1 ########################
2 # Job configuration for genesis/foreman
3 ########################
4 - project:
5
6     name: genesis-foreman
7
8     project: 'genesis'
9
10     installer: 'foreman'
11
12     jobs:
13         - 'genesis-foreman-verify'
14         - 'genesis-foreman-merge'
15         - 'genesis-foreman-daily-{stream}'
16         - 'genesis-foreman-build'
17         - 'genesis-foreman-deploy'
18
19     stream:
20         - master:
21             branch: 'master'
22
23 ########################
24 # job templates
25 ########################
26
27 - job-template:
28     name: 'genesis-foreman-verify'
29
30     project-type: freestyle
31
32     node: ericsson-build
33
34     concurrent: true
35
36     properties:
37         - throttle:
38             enabled: true
39             max-total: 2
40
41     logrotate:
42         daysToKeep: 30
43         numToKeep: 10
44         artifactDaysToKeep: -1
45         artifactNumToKeep: -1
46
47     parameters:
48         - project-parameter:
49             project: '{project}'
50         - gerrit-parameter:
51             branch: 'master'
52         - foreman-parameter:
53             installer: '{installer}'
54
55     scm:
56         - gerrit-trigger-scm:
57             credentials-id: '{ssh-credentials}'
58             refspec: '$GERRIT_REFSPEC'
59             choosing-strategy: 'gerrit'
60
61     wrappers:
62         - ssh-agent-credentials:
63             user: '{ssh-credentials}'
64
65     triggers:
66         - gerrit:
67             trigger-on:
68                 - patchset-created-event:
69                     exclude-drafts: 'false'
70                     exclude-trivial-rebase: 'false'
71                     exclude-no-code-change: 'false'
72                 - draft-published-event
73                 - comment-added-contains-event:
74                     comment-contains-value: 'recheck'
75                 - comment-added-contains-event:
76                     comment-contains-value: 'reverify'
77             projects:
78               - project-compare-type: 'ANT'
79                 project-pattern: 'genesis'
80                 branches:
81                   - branch-compare-type: 'ANT'
82                     branch-pattern: '**/master'
83                 file-paths:
84                   - compare-type: ANT
85                     pattern: 'common/**'
86                   - compare-type: ANT
87                     pattern: '{installer}/**'
88
89     builders:
90         - 'foreman-build'
91         - 'foreman-workspace-cleanup'
92
93 - job-template:
94     name: 'genesis-foreman-merge'
95
96     project-type: freestyle
97
98     node: ericsson-build
99
100     concurrent: true
101
102     properties:
103         - throttle:
104             enabled: true
105             max-total: 2
106
107     logrotate:
108         daysToKeep: 30
109         numToKeep: 40
110         artifactDaysToKeep: -1
111         artifactNumToKeep: 5
112
113     parameters:
114         - project-parameter:
115             project: '{project}'
116         - gerrit-parameter:
117             branch: 'master'
118         - foreman-parameter:
119             installer: '{installer}'
120
121     scm:
122         - gerrit-trigger-scm:
123             credentials-id: '{ssh-credentials}'
124             refspec: ''
125             choosing-strategy: 'default'
126
127     wrappers:
128         - ssh-agent-credentials:
129             user: '{ssh-credentials}'
130
131     triggers:
132         - gerrit:
133             trigger-on:
134                 - change-merged-event
135                 - comment-added-contains-event:
136                     comment-contains-value: 'remerge'
137             projects:
138               - project-compare-type: 'ANT'
139                 project-pattern: 'genesis'
140                 branches:
141                     - branch-compare-type: 'ANT'
142                       branch-pattern: '**/master'
143                 file-paths:
144                   - compare-type: ANT
145                     pattern: 'common/**'
146                   - compare-type: ANT
147                     pattern: '{installer}/**'
148
149     builders:
150         - 'foreman-build'
151         - 'foreman-workspace-cleanup'
152
153 - job-template:
154     name: 'genesis-foreman-daily-{stream}'
155
156     project-type: freestyle
157
158     node: ericsson-build
159
160     disabled: false
161
162     parameters:
163         - project-parameter:
164             project: '{project}'
165         - foreman-parameter:
166             installer: '{installer}'
167
168     scm:
169         - git-scm:
170             credentials-id: '{ssh-credentials}'
171             refspec: ''
172             branch: master
173
174     triggers:
175         - timed: '@midnight'
176
177     logrotate:
178         daysToKeep: 30
179         numToKeep: 10
180         artifactDaysToKeep: -1
181         artifactNumToKeep: -1
182
183     builders:
184         - trigger-builds:
185           - project: 'genesis-foreman-build'
186             git-revision: true
187             block: true
188         - trigger-builds:
189           - project: 'genesis-foreman-deploy'
190             git-revision: true
191             block: true
192         - trigger-builds:
193           - project: 'functest-opnfv-jump-2'
194             block: true
195
196 - job-template:
197     name: 'genesis-foreman-build'
198
199     project-type: freestyle
200
201     node: ericsson-build
202
203     logrotate:
204         daysToKeep: 30
205         numToKeep: 10
206         artifactDaysToKeep: -1
207         artifactNumToKeep: -1
208
209     parameters:
210         - project-parameter:
211             project: '{project}'
212         - foreman-parameter:
213             installer: '{installer}'
214
215     scm:
216         - git-scm:
217             credentials-id: '{ssh-credentials}'
218             refspec: ''
219             branch: master
220
221     builders:
222         - 'foreman-build'
223         - 'foreman-upload-artifact'
224
225 - job-template:
226     name: 'genesis-foreman-deploy'
227
228     project-type: freestyle
229
230     disabled: false
231
232     node: opnfv-jump-2
233
234     logrotate:
235         daysToKeep: 30
236         numToKeep: 10
237         artifactDaysToKeep: -1
238         artifactNumToKeep: -1
239
240     parameters:
241         - project-parameter:
242             project: '{project}'
243         - foreman-parameter:
244             installer: '{installer}'
245
246     scm:
247         - git-scm:
248             credentials-id: '{ssh-credentials}'
249             refspec: ''
250             branch: master
251
252     builders:
253         - 'foreman-deploy'
254
255 ########################
256 # parameter macros
257 ########################
258 - parameter:
259     name: foreman-parameter
260     parameters:
261         - string:
262             name: INSTALLER
263             default: '{installer}'
264             description: "Installer to use."
265         - string:
266             name: BUILD_DIRECTORY
267             default: $WORKSPACE/build_output
268             description: "Directory where the build artifact will be located upon the completion of the build."
269         - string:
270             name: CACHE_DIRECTORY
271             default: $HOME/opnfv/cache/genesis-$INSTALLER
272             description: "Directory where the cache to be used during the build is located."
273         - string:
274             name: GIT_BASE
275             default: https://gerrit.opnfv.org/gerrit/$PROJECT
276             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
277         - string:
278             name: GS_URL
279             default: artifacts.opnfv.org/$PROJECT/$INSTALLER
280             description: "URL to Google Storage."
281
282 ########################
283 # builder macros
284 ########################
285 - builder:
286     name: 'foreman-build'
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 "Starting the build of $INSTALLER. This could take some time..."
296             echo "--------------------------------------------------------"
297             echo
298
299             # create the cache directory if it doesn't exist
300             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
301
302             # set OPNFV_ARTIFACT_VERSION
303             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
304
305             # start the build
306             cd $WORKSPACE/$INSTALLER/ci
307             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
308
309             # list the contents of BUILD_OUTPUT directory
310             ls -al $BUILD_DIRECTORY
311
312             # save information regarding artifact into file
313             (
314                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
315                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
316                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
317                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
318                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
319                 echo "OPNFV_BUILD_URL=$BUILD_URL"
320             ) > $WORKSPACE/opnfv.properties
321
322             echo
323             echo "--------------------------------------------------------"
324             echo "Done!"
325
326 - builder:
327     name: 'foreman-deploy'
328     builders:
329         - shell: |
330             #!/bin/bash
331             set -o errexit
332             set -o nounset
333             set -o pipefail
334
335             # log info to console
336             echo "Starting the deployment using $INSTALLER. This could take some time..."
337             echo "--------------------------------------------------------"
338             echo
339
340             # cleanup first
341             sudo $WORKSPACE/$INSTALLER/ci/clean.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
342
343             # and then initiate deployment
344             sudo $WORKSPACE/$INSTALLER/ci/deploy.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
345
346             echo
347             echo "--------------------------------------------------------"
348             echo "Done!"
349
350 - builder:
351     name: 'foreman-upload-artifact'
352     builders:
353         - shell: |
354             #!/bin/bash
355             set -o errexit
356             set -o nounset
357             set -o pipefail
358
359             # log info to console
360             echo "Uploading the $INSTALLER artifact. This could take some time..."
361             echo "--------------------------------------------------------"
362             echo
363
364             # source the opnfv.properties to get ARTIFACT_VERSION
365             source $WORKSPACE/opnfv.properties
366
367             # upload artifact and additional files to google storage
368             gsutil cp $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
369             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
370             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
371
372             echo
373             echo "--------------------------------------------------------"
374             echo "Done!"
375
376 - builder:
377     name: 'foreman-workspace-cleanup'
378     builders:
379         - shell: |
380             #!/bin/bash
381             set -o errexit
382             set -o nounset
383             set -o pipefail
384
385             # delete everything that is in $WORKSPACE
386             /bin/rm -rf $WORKSPACE
387