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