Set default value for SKIP_BUILD if unset
[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         - string:
211             name: SKIP_BUILD
212             default: 0
213             description: "Temporary parameter for deployment testing to skip the build and run deployment only."
214
215     scm:
216         - git:
217             skip-tag: true
218             url: $GIT_BASE
219             branches:
220                 - $GERRIT_BRANCH
221             refspec: $GERRIT_REFSPEC
222
223     triggers:
224         - pollscm: '@midnight'
225
226     logrotate:
227         daysToKeep: 30
228         numToKeep: 10
229         artifactDaysToKeep: -1
230         artifactNumToKeep: -1
231
232     builders:
233         - 'installer-build'
234         - 'installer-deploy-quick-fix'
235
236 - builder:
237     name: installer-build
238     builders:
239         - shell: |
240             #!/bin/bash
241             set -o errexit
242             set -o nounset
243             set -o pipefail
244             set -x
245
246             # this is here for quick tries with deployment
247             SKIP_BUILD=${SKIP_BUILD-0}
248             if [ "$SKIP_BUILD" == "1" ]; then
249                 echo "Skipping build for deployment testing!"
250                 exit 0
251             else
252                 echo "Proceeding with build first!"
253             fi
254
255             # set/create the cache location
256             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
257
258             # do the build
259             cd $WORKSPACE/fuel/ci
260             ./build.sh -v $ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
261
262             # list the build artifacts
263             ls -al $BUILD_DIRECTORY
264
265 - builder:
266     name: installer-deploy-quick-fix
267     builders:
268         - shell: |
269             #!/bin/bash
270             set -o errexit
271             set -o nounset
272             set -o pipefail
273             set -x
274
275             # this is just a quick fix to execute the deployment in a messy way
276             # will be fixed later on
277             ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
278
279 - builder:
280     name: installer-test
281     builders:
282         - shell: |
283             #!/bin/bash
284             set -o errexit
285             set -o nounset
286             set -o pipefail
287             set -x
288
289             # run FuncTest
290             echo "Here is where we are supposed to run FuncTest"
291
292 - builder:
293     name: installer-upload-artifact
294     builders:
295         - shell: |
296             #!/bin/bash
297             set -o errexit
298             set -o nounset
299             set -o pipefail
300             set -x
301
302             # change the build directory where ISO is created
303             cd $BUILD_DIRECTORY
304
305             # save information regarding artifact into file
306             (
307                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
308                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
309                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$ARTIFACT_VERSION.iso"
310                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum opnfv-$ARTIFACT_VERSION.iso | cut -d' ' -f1)"
311                 echo "OPNFV_BUILD_URL=$BUILD_URL"
312                 echo "OPNFV_BUILD=OK"
313             ) > opnfv-$ARTIFACT_VERSION.properties
314
315             # copy artifact property file as latest.properties
316             # so we can directly get info regarding latest artifact
317             /bin/cp -f opnfv-$ARTIFACT_VERSION.properties latest.properties
318
319             # upload artifact and additional files to google storage
320             gsutil cp opnfv-$ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$ARTIFACT_VERSION.iso
321             gsutil cp opnfv-$ARTIFACT_VERSION.properties gs://$GS_URL/opnfv-$ARTIFACT_VERSION.properties
322             gsutil cp latest.properties gs://$GS_URL/latest.properties
323
324 - builder:
325     name: installer-download-artifact
326     builders:
327         - shell: |
328             #!/bin/bash
329             set -o errexit
330             set -o nounset
331             set -o pipefail
332             set -x
333
334             # get the latest.properties file in order to get info regarding latest artifact
335             gsutil cp gs://$GS_URL/latest.properties $WORKSPACE/latest.properties
336
337             # check if we got the file
338             [[ -f latest.properties ]] || exit 1
339
340             # source the file so we get OPNFV vars
341             source latest.properties
342
343             # download the file
344             gsutil cp gs://$OPNFV_ARTIFACT_URL $WORKSPACE/opnfv.iso
345
346             # list the file
347             ls -al $WORKSPACE/opnfv.iso
348
349 - builder:
350     name: installer-cleanup
351     builders:
352         - shell: |
353             #!/bin/bash
354             set -o errexit
355             set -o nounset
356             set -o pipefail
357             set -x
358
359             # delete everything that is in $WORKSPACE
360             /bin/rm -rf $WORKSPACE