Removes false blocking on build job
[releng.git] / jjb / apex / apex.yml
1 - project:
2     name: apex
3     jobs:
4         - 'apex-verify-{stream}'
5         - 'apex-merge-{stream}'
6         - 'apex-build-{stream}'
7         - 'apex-deploy-virtual-{stream}'
8         - 'apex-deploy-baremetal-{stream}'
9         - 'apex-daily-{stream}'
10
11     # stream:    branch with - in place of / (eg. stable-arno)
12     # branch:    branch (eg. stable/arno)
13     stream:
14         - master:
15             branch: 'master'
16             gs-pathname: ''
17
18     project: 'apex'
19
20 - job-template:
21     name: 'apex-verify-{stream}'
22
23     node: opnfv-jump-1
24
25     parameters:
26         - apex-parameter:
27             gs-pathname: '{gs-pathname}'
28         - project-parameter:
29             project: '{project}'
30         - gerrit-parameter:
31             branch: '{branch}'
32         - string:
33             name: GIT_BASE
34             default: https://gerrit.opnfv.org/gerrit/$PROJECT
35             description: "Used for overriding the GIT URL coming from parameters macro."
36
37     scm:
38         - gerrit-trigger-scm:
39             credentials-id: '{ssh-credentials}'
40             refspec: '$GERRIT_REFSPEC'
41             choosing-strategy: 'gerrit'
42
43     triggers:
44         - gerrit:
45             trigger-on:
46                 - patchset-created-event:
47                     exclude-drafts: 'false'
48                     exclude-trivial-rebase: 'false'
49                     exclude-no-code-change: 'false'
50                 - draft-published-event
51                 - comment-added-contains-event:
52                     comment-contains-value: 'recheck'
53                 - comment-added-contains-event:
54                     comment-contains-value: 'reverify'
55             projects:
56               - project-compare-type: 'ANT'
57                 project-pattern: 'apex'
58                 branches:
59                   - branch-compare-type: 'ANT'
60                     branch-pattern: '**/master'
61                 file-paths:
62                   - compare-type: ANT
63                     pattern: 'ci/**'
64                   - compare-type: ANT
65                     pattern: 'build/**'
66                   - compare-type: ANT
67                     pattern: 'lib/**'
68                   - compare-type: ANT
69                     pattern: 'config/**'
70                 forbidden-file-paths:
71                   - compare-type: ANT
72                     pattern: 'docs/**'
73
74     properties:
75         - build-blocker:
76             use-build-blocker: true
77             blocking-jobs:
78                 - "apex-daily.*"
79                 - "apex-deploy.*"
80                 - "apex-build.*"
81
82     builders:
83         - 'apex-build'
84         - 'apex-deploy-virtual'
85         - 'apex-workspace-cleanup'
86
87 - job-template:
88     name: 'apex-merge-{stream}'
89
90     # builder-merge job to run JJB update
91     #
92     # This job's purpose is to update all the JJB
93
94     node: opnfv-jump-1
95
96     disabled: true
97
98     parameters:
99         - apex-parameter:
100             gs-pathname: '{gs-pathname}'
101         - project-parameter:
102             project: '{project}'
103         - gerrit-parameter:
104             branch: '{branch}'
105         - string:
106             name: GIT_BASE
107             default: https://gerrit.opnfv.org/gerrit/$PROJECT
108             description: "Used for overriding the GIT URL coming from parameters macro."
109
110     scm:
111         - gerrit-trigger-scm:
112             credentials-id: '{ssh-credentials}'
113             refspec: ''
114             choosing-strategy: 'default'
115
116     triggers:
117         - gerrit:
118             trigger-on:
119                 - change-merged-event
120                 - comment-added-contains-event:
121                     comment-contains-value: 'remerge'
122             projects:
123               - project-compare-type: 'ANT'
124                 project-pattern: 'apex'
125                 branches:
126                     - branch-compare-type: 'ANT'
127                       branch-pattern: '**/master'
128                 forbidden-file-paths:
129                   - compare-type: ANT
130                     pattern: 'docs/**'
131
132     builders:
133         - 'apex-build'
134         - 'apex-deploy-virtual'
135         - 'apex-workspace-cleanup'
136
137 - job-template:
138     name: 'apex-build-{stream}'
139
140     # Job template for builds
141     #
142     # Required Variables:
143     #     stream:    branch with - in place of / (eg. stable)
144     #     branch:    branch (eg. stable)
145     node: opnfv-jump-1
146
147     disabled: false
148
149     parameters:
150         - project-parameter:
151             project: '{project}'
152         - apex-parameter:
153             gs-pathname: '{gs-pathname}'
154         - gerrit-parameter:
155             branch: '{branch}'
156         - string:
157             name: GIT_BASE
158             default: https://gerrit.opnfv.org/gerrit/$PROJECT
159             description: "Used for overriding the GIT URL coming from parameters macro."
160
161     scm:
162         - git-scm:
163             credentials-id: '{ssh-credentials}'
164             refspec: ''
165             branch: '{branch}'
166
167     properties:
168         - build-blocker:
169             use-build-blocker: true
170             blocking-jobs:
171                 - "apex-deploy.*"
172
173     builders:
174         - 'apex-build'
175         - 'apex-deploy-virtual'
176         - 'apex-upload-artifact'
177         - 'apex-workspace-cleanup'
178
179 - job-template:
180     name: 'apex-deploy-virtual-{stream}'
181
182     # Job template for virtual deployment
183     #
184     # Required Variables:
185     #     stream:    branch with - in place of / (eg. stable)
186     #     branch:    branch (eg. stable)
187     node: opnfv-jump-1
188
189     disabled: false
190
191     scm:
192         - git-scm:
193             credentials-id: '{ssh-credentials}'
194             refspec: ''
195             branch: '{branch}'
196
197     parameters:
198         - project-parameter:
199             project: '{project}'
200         - apex-parameter:
201             gs-pathname: '{gs-pathname}'
202
203     properties:
204         - build-blocker:
205             use-build-blocker: true
206             blocking-jobs:
207                 - "apex-verify.*"
208                 - "apex-deploy.*"
209                 - "apex-build.*"
210                 - "apex-daily.*"
211
212     builders:
213         - 'apex-deploy-virtual'
214         - 'apex-workspace-cleanup'
215
216 - job-template:
217     name: 'apex-deploy-baremetal-{stream}'
218
219     # Job template for baremetal deployment
220     #
221     # Required Variables:
222     #     stream:    branch with - in place of / (eg. stable)
223     #     branch:    branch (eg. stable)
224     node: opnfv-jump-1
225
226     disabled: false
227
228     scm:
229         - git-scm:
230             credentials-id: '{ssh-credentials}'
231             refspec: ''
232             branch: '{branch}'
233
234     parameters:
235         - project-parameter:
236             project: '{project}'
237         - apex-parameter:
238             gs-pathname: '{gs-pathname}'
239
240     properties:
241         - build-blocker:
242             use-build-blocker: true
243             blocking-jobs:
244                 - "apex-verify.*"
245                 - "apex-deploy.*"
246                 - "apex-build.*"
247                 - "apex-daily.*"
248
249     builders:
250         - 'apex-deploy-baremetal'
251         - 'apex-workspace-cleanup'
252
253 - job-template:
254     name: 'apex-daily-{stream}'
255
256     # Job template for daily build
257     #
258     # Required Variables:
259     #     stream:    branch with - in place of / (eg. stable)
260     #     branch:    branch (eg. stable)
261     node: opnfv-jump-1
262
263     disabled: false
264
265     scm:
266         - git-scm:
267             credentials-id: '{ssh-credentials}'
268             refspec: ''
269             branch: '{branch}'
270
271     parameters:
272         - project-parameter:
273             project: '{project}'
274         - apex-parameter:
275             gs-pathname: '{gs-pathname}'
276
277     properties:
278         - build-blocker:
279             use-build-blocker: true
280             blocking-jobs:
281                 - "apex-verify.*"
282                 - "apex-deploy.*"
283                 - "apex-build.*"
284
285     triggers:
286         - 'apex-{stream}'
287
288     builders:
289         - trigger-builds:
290           - project: 'apex-build-{stream}'
291             git-revision: true
292             block: true
293         - trigger-builds:
294           - project: 'apex-deploy-virtual-{stream}'
295             git-revision: true
296             block: true
297         - trigger-builds:
298           - project: 'functest-apex-opnfv-jump-1-daily-{stream}'
299             block: true
300             block-thresholds:
301                 build-step-failure-threshold: 'never'
302                 failure-threshold: 'never'
303                 unstable-threshold: 'FAILURE'
304
305 ########################
306 # parameter macros
307 ########################
308 - parameter:
309     name: apex-parameter
310     parameters:
311         - string:
312             name: ARTIFACT_NAME
313             default: 'latest'
314             description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
315         - string:
316             name: BUILD_DIRECTORY
317             default: $WORKSPACE/build_output
318             description: "Directory where the build artifact will be located upon the completion of the build."
319         - string:
320             name: CACHE_DIRECTORY
321             default: $HOME/opnfv/cache/{gs-pathname}
322             description: "Directory where the cache to be used during the build is located."
323         - string:
324             name: GIT_BASE
325             default: https://gerrit.opnfv.org/gerrit/$PROJECT
326             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
327         - string:
328             name: GS_URL
329             default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
330             description: "URL to Google Storage."
331
332 ########################
333 # builder macros
334 ########################
335 - builder:
336     name: 'apex-build'
337     builders:
338         - shell: |
339             #!/bin/bash
340             set -o errexit
341             set -o nounset
342             set -o pipefail
343             # log info to console
344             echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
345             echo "---------------------------------------------------------------------------------------"
346             echo
347             # create the cache directory if it doesn't exist
348             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
349             # set OPNFV_ARTIFACT_VERSION
350             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
351             # start the build
352             cd $WORKSPACE/ci
353             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
354             RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
355             # list the contents of BUILD_OUTPUT directory
356             ls -al $BUILD_DIRECTORY
357             # save information regarding artifact into file
358             (
359                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
360                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
361                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
362                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
363                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
364                 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
365                 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
366                 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
367                 echo "OPNFV_BUILD_URL=$BUILD_URL"
368             ) > $WORKSPACE/opnfv.properties
369             echo
370             echo "--------------------------------------------------------"
371
372 - builder:
373     name: 'apex-workspace-cleanup'
374     builders:
375         - shell: |
376             #!/bin/bash
377             set -o errexit
378             set -o nounset
379             set -o pipefail
380
381             # delete everything that is in $WORKSPACE
382             /bin/rm -rf $WORKSPACE
383
384 - builder:
385     name: 'apex-upload-artifact'
386     builders:
387         - shell: |
388             #!/bin/bash
389             set -o errexit
390             set -o nounset
391             set -o pipefail
392
393             # log info to console
394             echo "Uploading the Apex artifact. This could take some time..."
395             echo "--------------------------------------------------------"
396             echo
397
398             # source the opnfv.properties to get ARTIFACT_VERSION
399             source $WORKSPACE/opnfv.properties
400
401             # upload artifact and additional files to google storage
402             gsutil cp $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
403             gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
404             gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
405             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
406             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
407
408             echo
409             echo "--------------------------------------------------------"
410             echo "Done!"
411             echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
412             echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
413
414 - builder:
415     name: 'apex-deploy-virtual'
416     builders:
417         - shell: |
418             #!/bin/bash
419             set -o errexit
420             set -o nounset
421             set -o pipefail
422
423             # log info to console
424             echo "Starting the Apex virtual deployment."
425             echo "--------------------------------------------------------"
426             echo
427
428             if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
429                 # if artifact name is passed the pull a
430                 # specific artifact from artifacts.opnfv.org
431                 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
432             else
433                 if [[ -f opnfv.properties ]]; then
434                     # if opnfv.properties exists then use the
435                     # local build. Source the file so we get local OPNFV vars
436                     source opnfv.properties
437                     RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
438                 else
439                     # no opnfv.properties means use the latest from artifacts.opnfv.org
440                     # get the latest.properties to get the link to the latest artifact
441                     curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
442                     [[ -f opnfv.properties ]] || exit 1
443                     # source the file so we get OPNFV vars
444                     source opnfv.properties
445                     RPM_INSTALL_PATH=$OPNFV_RPM_URL
446                 fi
447             fi
448
449             source opnfv.properties
450             RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
451
452             # update / install the new rpm
453             if rpm -q opnfv-apex > /dev/null; then
454                if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
455                    sudo yum downgrade -y $RPM_INSTALL_PATH;
456                fi
457             else
458                sudo yum install -y $RPM_INSTALL_PATH;
459             fi
460
461             # cleanup virtual machines before we start
462             sudo opnfv-clean
463             # initiate virtual deployment
464             if [ -e /usr/share/doc/opnfv/network_settings.yaml.example ]; then
465               sudo opnfv-deploy -v -d /usr/share/doc/opnfv/deploy_settings.yaml.example -n /usr/share/doc/opnfv/network_settings.yaml.example
466             else
467               sudo opnfv-deploy -v
468             fi
469             echo
470             echo "--------------------------------------------------------"
471             echo "Done!"
472
473 - builder:
474     name: 'apex-deploy-baremetal'
475     builders:
476         - shell: |
477             #!/bin/bash
478             set -o errexit
479             set -o nounset
480             set -o pipefail
481
482             # log info to console
483             echo "Starting the Apex baremetal deployment."
484             echo "--------------------------------------------------------"
485             echo
486
487             if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
488                 # if artifact name is passed the pull a
489                 # specific artifact from artifacts.opnfv.org
490                 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
491             else
492                 if [[ -f opnfv.properties ]]; then
493                     # if opnfv.properties exists then use the
494                     # local build. Source the file so we get local OPNFV vars
495                     source opnfv.properties
496                     RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
497                 else
498                     # no opnfv.properties means use the latest from artifacts.opnfv.org
499                     # get the latest.properties to get the link to the latest artifact
500                     curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
501                     [[ -f opnfv.properties ]] || exit 1
502                     # source the file so we get OPNFV vars
503                     source opnfv.properties
504                     RPM_INSTALL_PATH=$OPNFV_RPM_URL
505                 fi
506             fi
507
508             source opnfv.properties
509             RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
510             if [ ! -e "$RPM_INSTALL_PATH" ]; then
511                RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
512             fi
513
514             # update / install the new rpm
515             if rpm -q opnfv-apex > /dev/null; then
516                if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
517                  echo "RPM is already installed"
518                elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
519                    sudo yum downgrade -y $RPM_INSTALL_PATH;
520                fi
521             else
522                sudo yum install -y $RPM_INSTALL_PATH;
523             fi
524
525             # cleanup environment before we start
526             sudo opnfv-clean
527             # initiate baremetal deployment
528             sudo opnfv-deploy -i  /root/inventory/pod_settings.yaml \
529             -d /usr/share/doc/opnfv/deploy_settings.yaml.example \
530             -n /root/network/network_settings.yaml
531
532             echo
533             echo "--------------------------------------------------------"
534             echo "Done!"
535
536 #######################
537 # trigger macros
538 ########################
539 - trigger:
540     name: 'apex-master'
541     triggers:
542         - timed: '0 3 * * *'