Apex, Functest: Enable smoke tests on Apex master verify
[releng.git] / jjb / apex / apex.yml
1 - project:
2     name: apex
3     jobs:
4         - 'apex-verify-{stream1}'
5         - 'apex-verify-{stream2}'
6         - 'apex-runner-{platform}-{scenario}-{stream}'
7         - 'apex-build-{stream}'
8         - 'apex-deploy-virtual-{scenario}-{stream}'
9         - 'apex-deploy-baremetal-{scenario}-{stream}'
10         - 'apex-daily-{stream1}'
11         - 'apex-daily-{stream2}'
12
13     # stream:    branch with - in place of / (eg. stable-arno)
14     # branch:    branch (eg. stable/arno)
15     stream:
16         - master:
17             branch: 'master'
18             gs-pathname: ''
19             block-stream: 'brahmaputra'
20             slave: 'intel-pod7'
21         - brahmaputra:
22             branch: 'stable/brahmaputra'
23             gs-pathname: '/brahmaputra'
24             block-stream: 'master'
25             slave: 'opnfv-jump-1'
26             disabled: false
27
28     stream1:
29         - master:
30             branch: 'master'
31             gs-pathname: ''
32             block-stream: 'brahmaputra'
33             slave: 'intel-pod7'
34
35     stream2:
36         - brahmaputra:
37             branch: 'stable/brahmaputra'
38             gs-pathname: '/brahmaputra'
39             block-stream: 'master'
40             slave: 'opnfv-jump-1'
41             disabled: false
42
43     project: 'apex'
44
45     scenario:
46          - 'os-nosdn-nofeature-ha'
47          - 'os-odl_l2-nofeature-ha'
48          - 'os-odl_l2-bgpvpn-ha'
49          - 'os-odl_l2-sfc-noha'
50          - 'os-odl_l3-nofeature-ha'
51          - 'os-onos-nofeature-ha'
52          - 'os-opencontrail-nofeature-ha'
53
54     platform:
55          - 'baremetal'
56          - 'virtual'
57
58 # Brahmaputra Verify
59 - job-template:
60     name: 'apex-verify-{stream2}'
61
62     node: '{slave}'
63
64     parameters:
65         - apex-parameter:
66             gs-pathname: '{gs-pathname}'
67         - project-parameter:
68             project: '{project}'
69         - gerrit-parameter:
70             branch: '{branch}'
71         - string:
72             name: GIT_BASE
73             default: https://gerrit.opnfv.org/gerrit/$PROJECT
74             description: "Used for overriding the GIT URL coming from parameters macro."
75
76     scm:
77         - gerrit-trigger-scm:
78             credentials-id: '{ssh-credentials}'
79             refspec: '$GERRIT_REFSPEC'
80             choosing-strategy: 'gerrit'
81
82     triggers:
83         - gerrit:
84             trigger-on:
85                 - patchset-created-event:
86                     exclude-drafts: 'false'
87                     exclude-trivial-rebase: 'false'
88                     exclude-no-code-change: 'true'
89                 - draft-published-event
90                 - comment-added-contains-event:
91                     comment-contains-value: 'recheck'
92                 - comment-added-contains-event:
93                     comment-contains-value: 'reverify'
94             projects:
95               - project-compare-type: 'ANT'
96                 project-pattern: 'apex'
97                 branches:
98                   - branch-compare-type: 'ANT'
99                     branch-pattern: '**/{branch}'
100                 file-paths:
101                   - compare-type: ANT
102                     pattern: 'ci/**'
103                   - compare-type: ANT
104                     pattern: 'build/**'
105                   - compare-type: ANT
106                     pattern: 'lib/**'
107                   - compare-type: ANT
108                     pattern: 'config/**'
109
110     properties:
111         - build-blocker:
112             use-build-blocker: true
113             blocking-jobs:
114                 - 'apex-daily.*{stream2}'
115                 - 'apex-deploy.*{stream2}'
116                 - 'apex-build.*{stream2}'
117                 - 'apex-runner.*{stream2}'
118                 - 'apex-verify-{stream2}'
119
120     builders:
121         - 'apex-build'
122         - trigger-builds:
123           - project: 'apex-deploy-virtual-os-odl_l2-nofeature-ha-{stream2}'
124             predefined-parameters: |
125               BUILD_DIRECTORY=apex-verify-{stream2}/build_output
126               OPNFV_CLEAN=yes
127             git-revision: false
128             block: true
129         - trigger-builds:
130           - project: 'apex-deploy-virtual-os-onos-nofeature-ha-{stream2}'
131             predefined-parameters: |
132               BUILD_DIRECTORY=apex-verify-{stream2}/build_output
133               OPNFV_CLEAN=yes
134             git-revision: false
135             block: true
136         - trigger-builds:
137           - project: 'apex-deploy-virtual-os-odl_l3-nofeature-ha-{stream2}'
138             predefined-parameters: |
139               BUILD_DIRECTORY=apex-verify-{stream2}/build_output
140               OPNFV_CLEAN=yes
141             git-revision: false
142             block: true
143         - trigger-builds:
144           - project: 'apex-deploy-virtual-os-odl_l2-sfc-noha-{stream2}'
145             predefined-parameters: |
146               BUILD_DIRECTORY=apex-verify-{stream2}/build_output
147               OPNFV_CLEAN=yes
148             git-revision: false
149             block: true
150         - 'apex-workspace-cleanup'
151
152 # Master Verify
153 - job-template:
154     name: 'apex-verify-{stream1}'
155
156     node: '{slave}'
157
158     parameters:
159         - apex-parameter:
160             gs-pathname: '{gs-pathname}'
161         - project-parameter:
162             project: '{project}'
163         - gerrit-parameter:
164             branch: '{branch}'
165         - string:
166             name: GIT_BASE
167             default: https://gerrit.opnfv.org/gerrit/$PROJECT
168             description: "Used for overriding the GIT URL coming from parameters macro."
169
170     scm:
171         - gerrit-trigger-scm:
172             credentials-id: '{ssh-credentials}'
173             refspec: '$GERRIT_REFSPEC'
174             choosing-strategy: 'gerrit'
175
176     triggers:
177         - gerrit:
178             trigger-on:
179                 - patchset-created-event:
180                     exclude-drafts: 'false'
181                     exclude-trivial-rebase: 'false'
182                     exclude-no-code-change: 'true'
183                 - draft-published-event
184                 - comment-added-contains-event:
185                     comment-contains-value: 'recheck'
186                 - comment-added-contains-event:
187                     comment-contains-value: 'reverify'
188             projects:
189               - project-compare-type: 'ANT'
190                 project-pattern: 'apex'
191                 branches:
192                   - branch-compare-type: 'ANT'
193                     branch-pattern: '**/{branch}'
194                 file-paths:
195                   - compare-type: ANT
196                     pattern: 'ci/**'
197                   - compare-type: ANT
198                     pattern: 'build/**'
199                   - compare-type: ANT
200                     pattern: 'lib/**'
201                   - compare-type: ANT
202                     pattern: 'config/**'
203
204     properties:
205         - build-blocker:
206             use-build-blocker: true
207             blocking-jobs:
208                 - 'apex-daily.*{stream1}'
209                 - 'apex-deploy.*{stream1}'
210                 - 'apex-build.*{stream1}'
211                 - 'apex-runner.*{stream1}'
212                 - 'apex-verify-{stream1}'
213
214     builders:
215         - 'apex-build'
216         - trigger-builds:
217           - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-{stream1}'
218             predefined-parameters: |
219               BUILD_DIRECTORY=apex-verify-{stream1}/build_output
220               OPNFV_CLEAN=yes
221             git-revision: false
222             block: true
223         - trigger-builds:
224           - project: 'functest-apex-{slave}-suite-{stream1}'
225             predefined-parameters: |
226               DEPLOY_SCENARIO=os-nosdn-nofeature-ha
227               FUNCTEST_SUITE_NAME=vping_userdata
228             block: true
229         - 'apex-workspace-cleanup'
230
231 - job-template:
232     name: 'apex-runner-{platform}-{scenario}-{stream}'
233
234     # runner jobs for deploying manually
235
236     node: '{slave}'
237
238     disabled: false
239
240     parameters:
241         - apex-parameter:
242             gs-pathname: '{gs-pathname}'
243         - project-parameter:
244             project: '{project}'
245         - gerrit-parameter:
246             branch: '{branch}'
247         - string:
248             name: GIT_BASE
249             default: https://gerrit.opnfv.org/gerrit/$PROJECT
250             description: "Used for overriding the GIT URL coming from parameters macro."
251
252     scm:
253         - gerrit-trigger-scm:
254             credentials-id: '{ssh-credentials}'
255             refspec: ''
256             choosing-strategy: 'default'
257
258     properties:
259         - build-blocker:
260             use-build-blocker: true
261             blocking-jobs:
262                 - 'apex-daily.*{stream}'
263                 - 'apex-verify.*{stream}'
264
265     builders:
266         - trigger-builds:
267           - project: 'apex-deploy-{platform}-{scenario}-{stream}'
268             predefined-parameters:
269               OPNFV_CLEAN=yes
270             git-revision: false
271             block: true
272         - trigger-builds:
273           - project: 'yardstick-apex-{slave}-daily-{stream}'
274             predefined-parameters:
275               DEPLOY_SCENARIO={scenario}
276             block: true
277             block-thresholds:
278                 build-step-failure-threshold: 'never'
279                 failure-threshold: 'never'
280                 unstable-threshold: 'FAILURE'
281         - trigger-builds:
282           - project: 'functest-apex-{slave}-daily-{stream}'
283             predefined-parameters:
284               DEPLOY_SCENARIO={scenario}
285             block: true
286             block-thresholds:
287                 build-step-failure-threshold: 'never'
288                 failure-threshold: 'never'
289                 unstable-threshold: 'FAILURE'
290
291 - job-template:
292     name: 'apex-build-{stream}'
293
294     # Job template for builds
295     #
296     # Required Variables:
297     #     stream:    branch with - in place of / (eg. stable)
298     #     branch:    branch (eg. stable)
299     node: '{slave}'
300
301     disabled: false
302
303     parameters:
304         - project-parameter:
305             project: '{project}'
306         - apex-parameter:
307             gs-pathname: '{gs-pathname}'
308         - gerrit-parameter:
309             branch: '{branch}'
310         - string:
311             name: GIT_BASE
312             default: https://gerrit.opnfv.org/gerrit/$PROJECT
313             description: "Used for overriding the GIT URL coming from parameters macro."
314
315     scm:
316         - git-scm:
317             credentials-id: '{ssh-credentials}'
318             refspec: ''
319             branch: '{branch}'
320
321     properties:
322         - build-blocker:
323             use-build-blocker: true
324             blocking-jobs:
325                 - 'apex-deploy.*{stream}'
326
327     builders:
328         - 'apex-build'
329         - trigger-builds:
330           - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-{stream}'
331             predefined-parameters: |
332               BUILD_DIRECTORY=apex-build-{stream}/build_output
333               OPNFV_CLEAN=yes
334             git-revision: false
335             block: true
336         - 'apex-upload-artifact'
337
338 - job-template:
339     name: 'apex-deploy-virtual-{scenario}-{stream}'
340
341     # Job template for virtual deployment
342     #
343     # Required Variables:
344     #     stream:    branch with - in place of / (eg. stable)
345     #     branch:    branch (eg. stable)
346     node: '{slave}'
347
348     disabled: false
349
350     scm:
351         - git-scm:
352             credentials-id: '{ssh-credentials}'
353             refspec: ''
354             branch: '{branch}'
355
356     parameters:
357         - project-parameter:
358             project: '{project}'
359         - apex-parameter:
360             gs-pathname: '{gs-pathname}'
361         - string:
362             name: DEPLOY_SCENARIO
363             default: '{scenario}'
364             description: "Scenario to deploy with."
365         - string:
366             name: OPNFV_CLEAN
367             default: 'no'
368             description: "Use yes in lower case to invoke clean. Indicates if the deploy environment should be cleaned before deployment"
369
370     properties:
371         - build-blocker:
372             use-build-blocker: true
373             blocking-jobs:
374                 - 'apex-deploy.*{stream}'
375
376     builders:
377         - 'apex-deploy-virtual'
378         - 'apex-workspace-cleanup'
379
380 - job-template:
381     name: 'apex-deploy-baremetal-{scenario}-{stream}'
382
383     # Job template for baremetal deployment
384     #
385     # Required Variables:
386     #     stream:    branch with - in place of / (eg. stable)
387     #     branch:    branch (eg. stable)
388     node: '{slave}'
389
390     disabled: false
391
392     scm:
393         - git-scm:
394             credentials-id: '{ssh-credentials}'
395             refspec: ''
396             branch: '{branch}'
397
398     parameters:
399         - project-parameter:
400             project: '{project}'
401         - apex-parameter:
402             gs-pathname: '{gs-pathname}'
403         - string:
404             name: DEPLOY_SCENARIO
405             default: '{scenario}'
406             description: "Scenario to deploy with."
407
408     properties:
409         - build-blocker:
410             use-build-blocker: true
411             blocking-jobs:
412                 - 'apex-verify.*{stream}'
413                 - 'apex-deploy.*{stream}'
414                 - 'apex-build.*{stream}'
415
416
417     builders:
418         - 'apex-deploy-baremetal'
419         - 'apex-workspace-cleanup'
420
421 # Brahmaputra Daily
422 - job-template:
423     name: 'apex-daily-{stream2}'
424
425     # Job template for daily build
426     #
427     # Required Variables:
428     #     stream:    branch with - in place of / (eg. stable)
429     #     branch:    branch (eg. stable)
430     node: '{slave}'
431
432     disabled: false
433
434     scm:
435         - git-scm:
436             credentials-id: '{ssh-credentials}'
437             refspec: ''
438             branch: '{branch}'
439
440     parameters:
441         - project-parameter:
442             project: '{project}'
443         - apex-parameter:
444             gs-pathname: '{gs-pathname}'
445
446     properties:
447         - build-blocker:
448             use-build-blocker: true
449             blocking-jobs:
450                 - 'apex-verify.*{stream2}'
451                 - 'apex-deploy.*{stream2}'
452                 - 'apex-build.*{stream2}'
453                 - 'apex-runner.*{stream2}'
454
455     triggers:
456         - 'apex-{stream2}'
457
458     builders:
459         - trigger-builds:
460           - project: 'apex-build-{stream2}'
461             git-revision: true
462             current-parameters: true
463             block: true
464         - trigger-builds:
465           - project: 'apex-deploy-baremetal-os-odl_l2-nofeature-ha-{stream2}'
466             predefined-parameters: |
467               BUILD_DIRECTORY=apex-build-{stream2}/build_output
468               OPNFV_CLEAN=yes
469             git-revision: true
470             block: true
471         - trigger-builds:
472           - project: 'functest-apex-{slave}-daily-{stream2}'
473             predefined-parameters:
474               DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
475             block: true
476             block-thresholds:
477                 build-step-failure-threshold: 'never'
478                 failure-threshold: 'never'
479                 unstable-threshold: 'FAILURE'
480         - trigger-builds:
481           - project: 'yardstick-apex-{slave}-daily-{stream2}'
482             predefined-parameters:
483               DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
484             block: true
485             block-thresholds:
486                 build-step-failure-threshold: 'never'
487                 failure-threshold: 'never'
488                 unstable-threshold: 'FAILURE'
489         - trigger-builds:
490           - project: 'apex-deploy-baremetal-os-onos-nofeature-ha-{stream2}'
491             predefined-parameters:
492               BUILD_DIRECTORY=apex-build-{stream2}/build_output
493             git-revision: true
494             block: true
495         - trigger-builds:
496           - project: 'functest-apex-{slave}-daily-{stream2}'
497             predefined-parameters:
498               DEPLOY_SCENARIO=os-onos-nofeature-ha
499             block: true
500             block-thresholds:
501                 build-step-failure-threshold: 'never'
502                 failure-threshold: 'never'
503                 unstable-threshold: 'FAILURE'
504         - trigger-builds:
505           - project: 'yardstick-apex-{slave}-daily-{stream2}'
506             predefined-parameters:
507               DEPLOY_SCENARIO=os-onos-nofeature-ha
508             block: true
509             block-thresholds:
510                 build-step-failure-threshold: 'never'
511                 failure-threshold: 'never'
512                 unstable-threshold: 'FAILURE'
513         - trigger-builds:
514           - project: 'apex-deploy-baremetal-os-odl_l3-nofeature-ha-{stream2}'
515             predefined-parameters:
516               BUILD_DIRECTORY=apex-build-{stream2}/build_output
517             git-revision: true
518             block: true
519         - trigger-builds:
520           - project: 'functest-apex-{slave}-daily-{stream2}'
521             predefined-parameters:
522               DEPLOY_SCENARIO=os-odl_l3-nofeature-ha
523             block: true
524             block-thresholds:
525                 build-step-failure-threshold: 'never'
526                 failure-threshold: 'never'
527                 unstable-threshold: 'FAILURE'
528         - trigger-builds:
529           - project: 'yardstick-apex-{slave}-daily-{stream2}'
530             predefined-parameters:
531               DEPLOY_SCENARIO=os-odl_l3-nofeature-ha
532             block: true
533             block-thresholds:
534                 build-step-failure-threshold: 'never'
535                 failure-threshold: 'never'
536                 unstable-threshold: 'FAILURE'
537         - trigger-builds:
538           - project: 'apex-deploy-baremetal-os-odl_l2-bgpvpn-ha-{stream2}'
539             predefined-parameters:
540               BUILD_DIRECTORY=apex-build-{stream2}/build_output
541             git-revision: true
542             block: true
543         - trigger-builds:
544           - project: 'functest-apex-{slave}-daily-{stream2}'
545             predefined-parameters:
546               DEPLOY_SCENARIO=os-odl_l2-bgpvpn-ha
547             block: true
548             block-thresholds:
549                 build-step-failure-threshold: 'never'
550                 failure-threshold: 'never'
551                 unstable-threshold: 'FAILURE'
552         - trigger-builds:
553           - project: 'yardstick-apex-{slave}-daily-{stream2}'
554             predefined-parameters:
555               DEPLOY_SCENARIO=os-odl_l2-bgpvpn-ha
556             block: true
557             block-thresholds:
558                 build-step-failure-threshold: 'never'
559                 failure-threshold: 'never'
560                 unstable-threshold: 'FAILURE'
561
562 # Master Daily
563 - job-template:
564     name: 'apex-daily-{stream1}'
565
566     # Job template for daily build
567     #
568     # Required Variables:
569     #     stream:    branch with - in place of / (eg. stable)
570     #     branch:    branch (eg. stable)
571     node: '{slave}'
572
573     disabled: false
574
575     scm:
576         - git-scm:
577             credentials-id: '{ssh-credentials}'
578             refspec: ''
579             branch: '{branch}'
580
581     parameters:
582         - project-parameter:
583             project: '{project}'
584         - apex-parameter:
585             gs-pathname: '{gs-pathname}'
586
587     properties:
588         - build-blocker:
589             use-build-blocker: true
590             blocking-jobs:
591                 - 'apex-verify.*{stream1}'
592                 - 'apex-deploy.*{stream1}'
593                 - 'apex-build.*{stream1}'
594                 - 'apex-runner.*{stream1}'
595
596     triggers:
597         - 'apex-{stream1}'
598
599     builders:
600         - trigger-builds:
601           - project: 'apex-build-{stream1}'
602             git-revision: true
603             current-parameters: true
604             block: true
605         - trigger-builds:
606           - project: 'apex-deploy-virtual-nosdn-nofeature-ha-{stream1}'
607             predefined-parameters: |
608               BUILD_DIRECTORY=apex-build-{stream1}/build_output
609               OPNFV_CLEAN=yes
610             git-revision: true
611             block: true
612         - trigger-builds:
613           - project: 'functest-apex-{slave}-daily-{stream1}'
614             predefined-parameters:
615               DEPLOY_SCENARIO=os-nosdn-nofeature-ha
616             block: true
617             block-thresholds:
618                 build-step-failure-threshold: 'never'
619                 failure-threshold: 'never'
620                 unstable-threshold: 'FAILURE'
621         - trigger-builds:
622           - project: 'yardstick-apex-{slave}-daily-{stream1}'
623             predefined-parameters:
624               DEPLOY_SCENARIO=os-nosdn-nofeature-ha
625             block: true
626             block-thresholds:
627                 build-step-failure-threshold: 'never'
628                 failure-threshold: 'never'
629                 unstable-threshold: 'FAILURE'
630
631 ########################
632 # parameter macros
633 ########################
634 - parameter:
635     name: apex-parameter
636     parameters:
637         - string:
638             name: ARTIFACT_NAME
639             default: 'latest'
640             description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
641         - string:
642             name: ARTIFACT_VERSION
643             default: 'daily'
644             description: "Artifact version type"
645         - string:
646             name: BUILD_DIRECTORY
647             default: $WORKSPACE/build_output
648             description: "Directory where the build artifact will be located upon the completion of the build."
649         - string:
650             name: CACHE_DIRECTORY
651             default: $HOME/opnfv/cache{gs-pathname}
652             description: "Directory where the cache to be used during the build is located."
653         - string:
654             name: GIT_BASE
655             default: https://gerrit.opnfv.org/gerrit/$PROJECT
656             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
657         - string:
658             name: GS_URL
659             default: artifacts.opnfv.org/$PROJECT{gs-pathname}
660             description: "URL to Google Storage."
661
662 ########################
663 # builder macros
664 ########################
665 - builder:
666     name: 'apex-build'
667     builders:
668         - shell: |
669             #!/bin/bash
670             set -o errexit
671             set -o nounset
672             set -o pipefail
673             # log info to console
674             echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
675             echo "---------------------------------------------------------------------------------------"
676             echo
677             # create the cache directory if it doesn't exist
678             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
679             # set OPNFV_ARTIFACT_VERSION
680             if echo $BUILD_TAG | grep "apex-verify" 1> /dev/null; then
681               if echo $GERRIT_BRANCH | grep "brahmaputra" 1> /dev/null; then
682                 export OPNFV_ARTIFACT_VERSION=brahmaputra-dev${BUILD_NUMBER}
683                 export BUILD_ARGS="-v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY"
684               else
685                 export OPNFV_ARTIFACT_VERSION=dev${BUILD_NUMBER}
686                 export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY"
687               fi
688             elif [ "$ARTIFACT_VERSION" == "daily" ]; then
689               if echo $GERRIT_BRANCH | grep "brahmaputra" 1> /dev/null; then
690                 export OPNFV_ARTIFACT_VERSION=brahmaputra-$(date -u +"%Y-%m-%d")
691                 export BUILD_ARGS="-v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY"
692               else
693                 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d")
694                 export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY --iso"
695               fi
696             else
697               export OPNFV_ARTIFACT_VERSION=${ARTIFACT_VERSION}
698               if echo $GERRIT_BRANCH | grep "brahmaputra" 1> /dev/null; then
699                 export BUILD_ARGS="-v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY"
700               else
701                 export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY --iso"
702               fi
703             fi
704             # clean for stable but doesn't matter for master
705             if echo $GERRIT_BRANCH | grep "brahmaputra" 1> /dev/null; then
706               sudo opnfv-clean
707             fi
708             # start the build
709             cd $WORKSPACE/ci
710             ./build.sh $BUILD_ARGS
711             RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
712             # list the contents of BUILD_OUTPUT directory
713             ls -al $BUILD_DIRECTORY
714             # save information regarding artifact into file
715             (
716                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
717                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
718                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
719                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
720                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
721                 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
722                 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
723                 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
724                 echo "OPNFV_BUILD_URL=$BUILD_URL"
725             ) > $WORKSPACE/opnfv.properties
726             echo "--------------------------------------------------------"
727             echo "Done!"
728
729 - builder:
730     name: 'apex-workspace-cleanup'
731     builders:
732         - shell: |
733             #!/bin/bash
734             set -o errexit
735             set -o nounset
736             set -o pipefail
737
738             # delete everything that is in $WORKSPACE
739             /bin/rm -rf $WORKSPACE
740
741 - builder:
742     name: 'apex-upload-artifact'
743     builders:
744         - shell: |
745             #!/bin/bash
746             set -o errexit
747             set -o nounset
748             set -o pipefail
749
750             # log info to console
751             echo "Uploading the Apex artifact. This could take some time..."
752             echo "--------------------------------------------------------"
753             echo
754
755             # source the opnfv.properties to get ARTIFACT_VERSION
756             source $WORKSPACE/opnfv.properties
757
758             # upload artifact and additional files to google storage
759             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
760             RPM_INSTALL_PATH=$BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL)
761             RPM_LIST=$RPM_INSTALL_PATH
762             for pkg in common undercloud opendaylight-sfc; do
763                 RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
764             done
765             SRPM_INSTALL_PATH=$BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL)
766             SRPM_LIST=$SRPM_INSTALL_PATH
767             for pkg in common undercloud opendaylight-sfc; do
768                 SRPM_LIST+=" ${SRPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
769             done
770             for artifact in $RPM_LIST $SRPM_LIST; do
771               gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log 2>&1
772             done
773             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
774             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
775
776             echo
777             echo "--------------------------------------------------------"
778             echo "Done!"
779             echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
780             echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
781
782 - builder:
783     name: 'apex-deploy-virtual'
784     builders:
785         - shell: |
786             #!/bin/bash
787             set -o errexit
788             set -o nounset
789             set -o pipefail
790
791             # log info to console
792             echo "Starting the Apex virtual deployment."
793             echo "--------------------------------------------------------"
794             echo
795
796             if [[ $BUILD_DIRECTORY == *verify-master* ]]; then
797                 cd $WORKSPACE/../${BUILD_DIRECTORY/build_output/}
798                 WORKSPACE=$(pwd)
799                 echo "WORKSPACE modified to $WORKSPACE"
800                 cd $WORKSPACE/ci
801             elif [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
802                 # if artifact name is passed the pull a
803                 # specific artifact from artifacts.opnfv.org
804                 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
805             else
806                 if [[ $BUILD_DIRECTORY == *verify* ]]; then
807                   BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
808                   echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
809                 elif [[ $BUILD_DIRECTORY == *apex-build* ]]; then
810                   BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
811                   echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
812                 fi
813
814                 if [[ -f ${BUILD_DIRECTORY}/../opnfv.properties ]]; then
815                     # if opnfv.properties exists then use the
816                     # local build. Source the file so we get local OPNFV vars
817                     source ${BUILD_DIRECTORY}/../opnfv.properties
818                     RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL)
819                 else
820                     if [[ $BUILD_DIRECTORY == *verify* ]]; then
821                       echo "BUILD_DIRECTORY is from a verify job, so will not use latest from URL"
822                       echo "Check that the slave has opnfv.properties in $BUILD_DIRECTORY"
823                       exit 1
824                     elif [[ $BUILD_DIRECTORY == *apex-build* ]]; then
825                       echo "BUILD_DIRECTORY is from a daily job, so will not use latest from URL"
826                       echo "Check that the slave has opnfv.properties in $BUILD_DIRECTORY"
827                       exit 1
828                     fi
829                     # no opnfv.properties means use the latest from artifacts.opnfv.org
830                     # get the latest.properties to get the link to the latest artifact
831                     curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
832                     [[ -f opnfv.properties ]] || exit 1
833                     # source the file so we get OPNFV vars
834                     source opnfv.properties
835                     RPM_INSTALL_PATH=$OPNFV_RPM_URL
836                 fi
837             fi
838
839             if [ -z "$DEPLOY_SCENARIO" ]; then
840               echo "Deploy scenario not set!"
841               exit 1
842             fi
843
844             # use local build for verify
845             if [[ $BUILD_DIRECTORY == *verify-master* ]]; then
846                 if [ ! -e "${WORKSPACE}/build/lib" ]; then ln -s ${WORKSPACE}/lib ${WORKSPACE}/build/lib; fi
847                 DEPLOY_CMD="./deploy.sh -c ${WORKSPACE}/build -r ${WORKSPACE}/build/images/"
848                 DEPLOY_FILE="${WORKSPACE}/config/deploy/${DEPLOY_SCENARIO}.yaml"
849                 NETWORK_FILE="${WORKSPACE}/config/network/network_settings.yaml"
850             else
851                 RPM_LIST=$RPM_INSTALL_PATH
852                 for pkg in common undercloud opendaylight-sfc; do
853                     RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
854                 done
855
856                 # update / install the new rpm
857                 if rpm -q opnfv-apex > /dev/null; then
858                    if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
859                      echo "RPM is already installed"
860                    elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
861                        if ! sudo yum downgrade -y $RPM_LIST; then
862                          sudo yum remove -y opnfv-undercloud opnfv-common
863                          sudo yum downgrade -y $RPM_INSTALL_PATH
864                        fi
865                    fi
866                 else
867                    sudo yum install -y $RPM_LIST;
868                 fi
869                 DEPLOY_CMD=opnfv-deploy
870                 DEPLOY_FILE="/etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
871                 NETWORK_FILE="/etc/opnfv-apex/network_settings.yaml"
872             fi
873
874             if [ "$OPNFV_CLEAN" == 'yes' ]; then
875                 if [[ $BUILD_DIRECTORY == *verify-master* ]]; then
876                     sudo ./clean.sh
877                 else
878                     sudo opnfv-clean
879                 fi
880             fi
881             # initiate virtual deployment
882             echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
883             if [ -e $DEPLOY_FILE ]; then
884               sudo $DEPLOY_CMD -v -d ${DEPLOY_FILE} -n $NETWORK_FILE --debug
885             else
886               echo "File does not exist /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
887               exit 1
888             fi
889             echo
890             echo "--------------------------------------------------------"
891             echo "Done!"
892
893 - builder:
894     name: 'apex-deploy-baremetal'
895     builders:
896         - shell: |
897             #!/bin/bash
898             set -o errexit
899             set -o nounset
900             set -o pipefail
901
902             # log info to console
903             echo "Starting the Apex baremetal deployment."
904             echo "--------------------------------------------------------"
905             echo
906
907             if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
908                 # if artifact name is passed the pull a
909                 # specific artifact from artifacts.opnfv.org
910                 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
911             else
912                 if [[ $BUILD_DIRECTORY == *apex-build* ]]; then
913                   BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
914                   echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
915                 fi
916                 if [[ -f ${BUILD_DIRECTORY}/../opnfv.properties ]]; then
917                     # if opnfv.properties exists then use the
918                     # local build. Source the file so we get local OPNFV vars
919                     source ${BUILD_DIRECTORY}/../opnfv.properties
920                     RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL)
921                 else
922                     # no opnfv.properties means use the latest from artifacts.opnfv.org
923                     # get the latest.properties to get the link to the latest artifact
924                     curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
925                     [[ -f opnfv.properties ]] || exit 1
926                     # source the file so we get OPNFV vars
927                     source opnfv.properties
928                     RPM_INSTALL_PATH=$OPNFV_RPM_URL
929                 fi
930             fi
931
932             if [ ! -e "$RPM_INSTALL_PATH" ]; then
933                RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
934             fi
935
936             RPM_LIST=$RPM_INSTALL_PATH
937             for pkg in common undercloud; do
938                 RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
939             done
940
941             # update / install the new rpm
942             if rpm -q opnfv-apex > /dev/null; then
943                if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
944                  echo "RPM is already installed"
945                elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
946                    if ! sudo yum downgrade -y $RPM_LIST; then
947                      sudo yum remove -y opnfv-undercloud opnfv-common
948                      sudo yum downgrade -y $RPM_INSTALL_PATH
949                    fi
950                fi
951             else
952                sudo yum install -y $RPM_LIST;
953             fi
954
955             # cleanup environment before we start
956             sudo opnfv-clean
957             # initiate baremetal deployment
958             if [ -e /etc/opnfv-apex/network_settings.yaml ]; then
959               if [ -n "$DEPLOY_SCENARIO" ]; then
960                 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
961                 if [ -e /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml ]; then
962                   sudo opnfv-deploy -i  /root/inventory/pod_settings.yaml \
963                   -d /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml \
964                   -n /root/network/network_settings.yaml --debug
965                 else
966                   echo "File does not exist /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
967                   exit 1
968                 fi
969               else
970                 echo "Deploy scenario not set!"
971                 exit 1
972               fi
973             else
974               echo "File /etc/opnfv-apex/network_settings.yaml does not exist!"
975               exit 1
976             fi
977
978             echo
979             echo "--------------------------------------------------------"
980             echo "Done!"
981
982 #######################
983 # trigger macros
984 ########################
985 - trigger:
986     name: 'apex-master'
987     triggers:
988         - timed: '0 3 * * *'
989 - trigger:
990     name: 'apex-brahmaputra'
991     triggers:
992         - timed: '0 3 * * *'