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