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