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