c9018750d9157701d2600d5b8cb71a16ad0f7420
[releng.git] / jjb / genesis / genesis-fuel.yml
1 # this is the job configuration for bgs
2 - project:
3
4     name: genesis-fuel
5
6     installer:
7         - fuel
8     jobs:
9         - 'genesis-fuel-verify'
10         - 'genesis-fuel-merge'
11         - 'genesis-fuel-daily-{stream}'
12
13     # stream:    branch with - in place of / (eg. stable-helium)
14     # branch:    branch (eg. stable/helium)
15     stream:
16         - master:
17             branch: 'master'
18
19     project: 'genesis'
20
21 ########################
22 # job templates
23 ########################
24
25 - job-template:
26     name: 'genesis-fuel-verify'
27
28     project-type: freestyle
29
30     node: ericsson-build
31
32     logrotate:
33         daysToKeep: 30
34         numToKeep: 10
35         artifactDaysToKeep: -1
36         artifactNumToKeep: -1
37
38     parameters:
39         - string:
40             name: GIT_BASE
41             default: https://gerrit.opnfv.org/gerrit/genesis
42             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
43         - string:
44             name: GS_URL
45             default: 'artifacts.opnfv.org/genesis/fuel'
46             description: "URL to Google Storage."
47         - string:
48             name: BUILD_DIRECTORY
49             default: $WORKSPACE/build_output
50             description: "Directory where the build artifact will be located upon the completion of the build."
51         - string:
52             name: CACHE_DIRECTORY
53             default: $HOME/opnfv/cache/genesis-fuel
54             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
55         - string:
56             name: ARTIFACT_VERSION
57             default: $BUILD_ID
58             description: "Version number to append to resulting ISO."
59         - gerrit-parameter:
60             branch: 'master'
61
62     scm:
63         - gerrit-trigger-scm:
64             credentials-id: '{ssh-credentials}'
65             refspec: '$GERRIT_REFSPEC'
66             choosing-strategy: 'gerrit'
67
68     wrappers:
69         - ssh-agent-credentials:
70             user: '{ssh-credentials}'
71
72     triggers:
73         - gerrit:
74             trigger-on:
75                 - patchset-created-event:
76                     exclude-drafts: 'false'
77                     exclude-trivial-rebase: 'false'
78                     exclude-no-code-change: 'false'
79                 - draft-published-event
80                 - comment-added-contains-event:
81                     comment-contains-value: 'recheck'
82                 - comment-added-contains-event:
83                     comment-contains-value: 'reverify'
84             projects:
85               - project-compare-type: 'ANT'
86                 project-pattern: 'genesis'
87                 branches:
88                   - branch-compare-type: 'ANT'
89                     branch-pattern: '**/master'
90                 file-paths:
91                   - compare-type: ANT
92                     pattern: 'common/**'
93                   - compare-type: ANT
94                     pattern: 'fuel/**'
95
96
97     builders:
98         - 'installer-build'
99         - 'installer-cleanup'
100
101 - job-template:
102     name: 'genesis-fuel-merge'
103
104     # builder-merge job to run JJB update
105     #
106     # This job's purpose is to update all the JJB
107
108     project-type: freestyle
109
110     node: ericsson-build
111
112     logrotate:
113         daysToKeep: 30
114         numToKeep: 40
115         artifactDaysToKeep: -1
116         artifactNumToKeep: 5
117
118     parameters:
119         - string:
120             name: GIT_BASE
121             default: https://gerrit.opnfv.org/gerrit/genesis
122             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
123         - string:
124             name: GS_URL
125             default: 'artifacts.opnfv.org/genesis/fuel'
126             description: "URL to Google Storage."
127         - string:
128             name: BUILD_DIRECTORY
129             default: $WORKSPACE/build_output
130             description: "Directory where the build artifact will be located upon the completion of the build."
131         - string:
132             name: CACHE_DIRECTORY
133             default: $HOME/opnfv/cache/genesis-fuel
134             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
135         - string:
136             name: ARTIFACT_VERSION
137             default: $BUILD_ID
138             description: "Version number to append to resulting ISO."
139         - gerrit-parameter:
140             branch: 'master'
141
142     scm:
143         - gerrit-trigger-scm:
144             credentials-id: '{ssh-credentials}'
145             refspec: ''
146             choosing-strategy: 'default'
147
148     wrappers:
149         - ssh-agent-credentials:
150             user: '{ssh-credentials}'
151
152     triggers:
153         - gerrit:
154             trigger-on:
155                 - change-merged-event
156                 - comment-added-contains-event:
157                     comment-contains-value: 'remerge'
158             projects:
159               - project-compare-type: 'ANT'
160                 project-pattern: 'genesis'
161                 branches:
162                     - branch-compare-type: 'ANT'
163                       branch-pattern: '**/master'
164                 file-paths:
165                   - compare-type: ANT
166                     pattern: 'common/**'
167                   - compare-type: ANT
168                     pattern: 'fuel/**'
169
170     builders:
171         - 'installer-build'
172         - 'installer-cleanup'
173
174 - job-template:
175     name: 'genesis-fuel-daily-{stream}'
176
177     project-type: freestyle
178
179     node: ericsson-build
180
181     parameters:
182         - string:
183             name: GIT_BASE
184             default: https://gerrit.opnfv.org/gerrit/genesis
185             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
186         - string:
187             name: GERRIT_BRANCH
188             default: origin/master
189             description: "Branch to build, deploy and test."
190         - string:
191             name: GERRIT_REFSPEC
192             default: refs/heads/master
193             description: "Refspec to retrieve."
194         - string:
195             name: GS_URL
196             default: 'artifacts.opnfv.org/genesis/fuel'
197             description: "URL to Google Storage."
198         - string:
199             name: BUILD_DIRECTORY
200             default: $WORKSPACE/build_output
201             description: "Directory where the build artifact will be located upon the completion of the build."
202         - string:
203             name: CACHE_DIRECTORY
204             default: $HOME/opnfv/cache/genesis-fuel
205             description: "Cache location that is where the cache is populated and used during builds to reduce the build time."
206         - string:
207             name: ARTIFACT_VERSION
208             default: $BUILD_ID
209             description: "Version number to append to resulting ISO."
210
211     scm:
212         - git:
213             skip-tag: true
214             url: $GIT_BASE
215             branches:
216                 - $GERRIT_BRANCH
217             refspec: $GERRIT_REFSPEC
218
219     triggers:
220         - pollscm: '@midnight'
221
222     logrotate:
223         daysToKeep: 30
224         numToKeep: 10
225         artifactDaysToKeep: -1
226         artifactNumToKeep: -1
227
228     builders:
229         - 'installer-build'
230         - 'installer-upload-artifact'
231         - 'installer-download-artifact'
232         - 'installer-deploy'
233         - 'installer-test'
234         - 'installer-cleanup'
235
236
237 - builder:
238     name: installer-build
239     builders:
240         - shell: |
241             #!/bin/bash
242             set -o errexit
243             set -o nounset
244             set -o pipefail
245             set -x
246
247             # set/create the cache location
248             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
249
250             # do the build
251             cd $WORKSPACE/fuel/ci
252             ./build.sh -v $ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
253
254             # list the build artifacts
255             ls -al $BUILD_DIRECTORY
256
257 - builder:
258     name: installer-deploy
259     builders:
260         - shell: |
261             #!/bin/bash
262             set -o errexit
263             set -o nounset
264             set -o pipefail
265             set -x
266
267             # we should have the artifact itself downloaded by now
268             # look if it is there
269             if [ -f $WORKSPACE/opnfv.iso ]; then
270                 echo "Artifact fetched!"
271                 ls -al $WORKSPACE/opnfv.iso
272             else
273                 echo "Artifact does not exist!"
274                 exit 1
275             fi
276
277             # we should have the artifact properties file downloaded by now
278             # look if it is there
279             if [ -f $WORKSPACE/latest.properties ]; then
280                 echo "Artifact properties file fetched!"
281                 ls -al $WORKSPACE/latest.properties
282             else
283                 echo "Artifact properties file does not exist!"
284                 exit 1
285             fi
286
287             # source the file so we get OPNFV vars
288             source $WORKSPACE/latest.properties
289
290             # log the info
291             echo "Proceeding with deployment using ISO downloaded from below URL"
292             echo "$OPNFV_ARTIFACT_URL"
293             echo "This artifact was built using $OPNFV_GIT_SHA1 version of repo $OPNFV_GIT_URL"
294
295             # execute deploy.sh
296             echo "Here is where we are supposed to issue deploy.sh"
297
298 - builder:
299     name: installer-test
300     builders:
301         - shell: |
302             #!/bin/bash
303             set -o errexit
304             set -o nounset
305             set -o pipefail
306             set -x
307
308             # run FuncTest
309             echo "Here is where we are supposed to run FuncTest"
310
311 - builder:
312     name: installer-upload-artifact
313     builders:
314         - shell: |
315             #!/bin/bash
316             set -o errexit
317             set -o nounset
318             set -o pipefail
319             set -x
320
321             # change the build directory where ISO is created
322             cd $BUILD_DIRECTORY
323
324             # save information regarding artifact into file
325             (
326                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
327                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
328                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$ARTIFACT_VERSION.iso"
329                 echo "OPNFV_BUILD_URL=$BUILD_URL"
330                 echo "OPNFV_BUILD=OK"
331             ) > opnfv-$ARTIFACT_VERSION.properties
332
333             # copy artifact property file as latest.properties
334             # so we can directly get info regarding latest artifact
335             /bin/cp -f opnfv-$ARTIFACT_VERSION.properties latest.properties
336
337             # upload artifact and additional files to google storage
338             gsutil cp opnfv-$ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$ARTIFACT_VERSION.iso
339             gsutil cp opnfv-$ARTIFACT_VERSION.properties gs://$GS_URL/opnfv-$ARTIFACT_VERSION.properties
340             gsutil cp latest.properties gs://$GS_URL/latest.properties
341
342 - builder:
343     name: installer-download-artifact
344     builders:
345         - shell: |
346             #!/bin/bash
347             set -o errexit
348             set -o nounset
349             set -o pipefail
350             set -x
351
352             # get the latest.properties file in order to get info regarding latest artifact
353             gsutil cp gs://$GS_URL/latest.properties $WORKSPACE/latest.properties
354
355             # check if we got the file
356             [[ -f latest.properties ]] || exit 1
357
358             # source the file so we get OPNFV vars
359             source latest.properties
360
361             # download the file
362             gsutil cp gs://$OPNFV_ARTIFACT_URL $WORKSPACE/opnfv.iso
363
364             # list the file
365             ls -al $WORKSPACE/opnfv.iso
366
367 - builder:
368     name: installer-cleanup
369     builders:
370         - shell: |
371             #!/bin/bash
372             set -o errexit
373             set -o nounset
374             set -o pipefail
375             set -x
376
377             # delete everything that is in $WORKSPACE
378             /bin/rm -rf $WORKSPACE