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