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