Disable scheduled runs for foreman/fuel daily master
[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     logrotate:
175         daysToKeep: 30
176         numToKeep: 10
177         artifactDaysToKeep: -1
178         artifactNumToKeep: -1
179
180     builders:
181         - trigger-builds:
182           - project: 'genesis-foreman-build'
183             git-revision: true
184             block: true
185         - trigger-builds:
186           - project: 'genesis-foreman-deploy'
187             git-revision: true
188             block: true
189         - trigger-builds:
190           - project: 'functest-opnfv-jump-2'
191             block: true
192
193 - job-template:
194     name: 'genesis-foreman-build'
195
196     project-type: freestyle
197
198     node: ericsson-build
199
200     logrotate:
201         daysToKeep: 30
202         numToKeep: 10
203         artifactDaysToKeep: -1
204         artifactNumToKeep: -1
205
206     parameters:
207         - project-parameter:
208             project: '{project}'
209         - foreman-parameter:
210             installer: '{installer}'
211
212     scm:
213         - git-scm:
214             credentials-id: '{ssh-credentials}'
215             refspec: ''
216             branch: master
217
218     builders:
219         - 'foreman-build'
220         - 'foreman-upload-artifact'
221
222 - job-template:
223     name: 'genesis-foreman-deploy'
224
225     project-type: freestyle
226
227     disabled: false
228
229     node: opnfv-jump-2
230
231     logrotate:
232         daysToKeep: 30
233         numToKeep: 10
234         artifactDaysToKeep: -1
235         artifactNumToKeep: -1
236
237     parameters:
238         - project-parameter:
239             project: '{project}'
240         - foreman-parameter:
241             installer: '{installer}'
242         - string:
243             name: GIT_BASE
244             default: ssh://gerrit.opnfv.org:29418/$PROJECT
245             description: "Used for overriding the GIT URL coming from parameters macro."
246
247     scm:
248         - git-scm:
249             credentials-id: '{ssh-credentials}'
250             refspec: ''
251             branch: master
252
253     builders:
254         - 'foreman-deploy'
255
256 ########################
257 # parameter macros
258 ########################
259 - parameter:
260     name: foreman-parameter
261     parameters:
262         - string:
263             name: INSTALLER
264             default: '{installer}'
265             description: "Installer to use."
266         - string:
267             name: BUILD_DIRECTORY
268             default: $WORKSPACE/build_output
269             description: "Directory where the build artifact will be located upon the completion of the build."
270         - string:
271             name: CACHE_DIRECTORY
272             default: $HOME/opnfv/cache/genesis-$INSTALLER
273             description: "Directory where the cache to be used during the build is located."
274         - string:
275             name: GIT_BASE
276             default: https://gerrit.opnfv.org/gerrit/$PROJECT
277             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
278         - string:
279             name: GS_URL
280             default: artifacts.opnfv.org/$PROJECT/$INSTALLER
281             description: "URL to Google Storage."
282
283 ########################
284 # builder macros
285 ########################
286 - builder:
287     name: 'foreman-build'
288     builders:
289         - shell: |
290             #!/bin/bash
291             set -o errexit
292             set -o nounset
293             set -o pipefail
294
295             # log info to console
296             echo "Starting the build of $INSTALLER. This could take some time..."
297             echo "--------------------------------------------------------"
298             echo
299
300             # create the cache directory if it doesn't exist
301             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
302
303             # set OPNFV_ARTIFACT_VERSION
304             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
305
306             # start the build
307             cd $WORKSPACE/$INSTALLER/ci
308             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
309
310             # list the contents of BUILD_OUTPUT directory
311             ls -al $BUILD_DIRECTORY
312
313             # save information regarding artifact into file
314             (
315                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
316                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
317                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
318                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
319                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
320                 echo "OPNFV_BUILD_URL=$BUILD_URL"
321             ) > $WORKSPACE/opnfv.properties
322
323             echo
324             echo "--------------------------------------------------------"
325             echo "Done!"
326
327 - builder:
328     name: 'foreman-deploy'
329     builders:
330         - shell: |
331             #!/bin/bash
332             set -o errexit
333             set -o nounset
334             set -o pipefail
335
336             # log info to console
337             echo "Starting the deployment using $INSTALLER. This could take some time..."
338             echo "--------------------------------------------------------"
339             echo
340
341             # cleanup first
342             sudo $WORKSPACE/$INSTALLER/ci/clean.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
343
344             # and then initiate deployment
345             sudo $WORKSPACE/$INSTALLER/ci/deploy.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
346
347             echo
348             echo "--------------------------------------------------------"
349             echo "Done!"
350
351 - builder:
352     name: 'foreman-upload-artifact'
353     builders:
354         - shell: |
355             #!/bin/bash
356             set -o errexit
357             set -o nounset
358             set -o pipefail
359
360             # log info to console
361             echo "Uploading the $INSTALLER artifact. This could take some time..."
362             echo "--------------------------------------------------------"
363             echo
364
365             # source the opnfv.properties to get ARTIFACT_VERSION
366             source $WORKSPACE/opnfv.properties
367
368             # upload artifact and additional files to google storage
369             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
370             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
371             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
372
373             echo
374             echo "--------------------------------------------------------"
375             echo "Done!"
376
377 - builder:
378     name: 'foreman-workspace-cleanup'
379     builders:
380         - shell: |
381             #!/bin/bash
382             set -o errexit
383             set -o nounset
384             set -o pipefail
385
386             # delete everything that is in $WORKSPACE
387             /bin/rm -rf $WORKSPACE
388