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