apex: adds ODL L3 to daily job
[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         - trigger-builds:
382           - project: 'apex-deploy-baremetal-os-odl_l3-nofeature-ha-{stream}'
383             predefined-parameters:
384               BUILD_DIRECTORY=apex-build-master/build_output
385             git-revision: true
386             block: true
387         - trigger-builds:
388           - project: 'functest-apex-opnfv-jump-1-daily-{stream}'
389             predefined-parameters:
390               DEPLOY_SCENARIO=os-odl_l3-nofeature-ha
391             block: true
392             block-thresholds:
393                 build-step-failure-threshold: 'never'
394                 failure-threshold: 'never'
395                 unstable-threshold: 'FAILURE'
396         - trigger-builds:
397           - project: 'yardstick-apex-opnfv-jump-1-daily-{stream}'
398             block: true
399             block-thresholds:
400                 build-step-failure-threshold: 'never'
401                 failure-threshold: 'never'
402                 unstable-threshold: 'FAILURE'
403
404 ########################
405 # parameter macros
406 ########################
407 - parameter:
408     name: apex-parameter
409     parameters:
410         - string:
411             name: ARTIFACT_NAME
412             default: 'latest'
413             description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
414         - string:
415             name: ARTIFACT_VERSION
416             default: 'daily'
417             description: "Artifact version type"
418         - string:
419             name: BUILD_DIRECTORY
420             default: $WORKSPACE/build_output
421             description: "Directory where the build artifact will be located upon the completion of the build."
422         - string:
423             name: CACHE_DIRECTORY
424             default: $HOME/opnfv/cache{gs-pathname}
425             description: "Directory where the cache to be used during the build is located."
426         - string:
427             name: GIT_BASE
428             default: https://gerrit.opnfv.org/gerrit/$PROJECT
429             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
430         - string:
431             name: GS_URL
432             default: artifacts.opnfv.org/$PROJECT{gs-pathname}
433             description: "URL to Google Storage."
434
435 ########################
436 # builder macros
437 ########################
438 - builder:
439     name: 'apex-build'
440     builders:
441         - shell: |
442             #!/bin/bash
443             set -o errexit
444             set -o nounset
445             set -o pipefail
446             # log info to console
447             echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
448             echo "---------------------------------------------------------------------------------------"
449             echo
450             # create the cache directory if it doesn't exist
451             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
452             # set OPNFV_ARTIFACT_VERSION
453             if echo $GERRIT_BRANCH | grep "brahmaputra" 1> /dev/null; then
454               export OPNFV_ARTIFACT_VERSION="bramaputra.1.rc0"
455             else
456               if echo $BUILD_TAG | grep "apex-verify" 1> /dev/null; then
457                 export OPNFV_ARTIFACT_VERSION=dev${BUILD_NUMBER}
458               elif [ "$ARTIFACT_VERSION" == "daily" ]; then
459                 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d")
460               else
461                 export OPNFV_ARTIFACT_VERSION=${ARTIFACT_VERSION}
462               fi
463             fi
464             # start the build
465             cd $WORKSPACE/ci
466             ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
467             RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
468             # list the contents of BUILD_OUTPUT directory
469             ls -al $BUILD_DIRECTORY
470             # save information regarding artifact into file
471             (
472                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
473                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
474                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
475                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
476                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
477                 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
478                 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
479                 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
480                 echo "OPNFV_BUILD_URL=$BUILD_URL"
481             ) > $WORKSPACE/opnfv.properties
482             echo
483             echo "--------------------------------------------------------"
484
485 - builder:
486     name: 'apex-workspace-cleanup'
487     builders:
488         - shell: |
489             #!/bin/bash
490             set -o errexit
491             set -o nounset
492             set -o pipefail
493
494             # delete everything that is in $WORKSPACE
495             /bin/rm -rf $WORKSPACE
496
497 - builder:
498     name: 'apex-upload-artifact'
499     builders:
500         - shell: |
501             #!/bin/bash
502             set -o errexit
503             set -o nounset
504             set -o pipefail
505
506             # log info to console
507             echo "Uploading the Apex artifact. This could take some time..."
508             echo "--------------------------------------------------------"
509             echo
510
511             # source the opnfv.properties to get ARTIFACT_VERSION
512             source $WORKSPACE/opnfv.properties
513
514             # upload artifact and additional files to google storage
515             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
516             RPM_INSTALL_PATH=$BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL)
517             RPM_LIST=$RPM_INSTALL_PATH
518             for pkg in common undercloud; do
519                 RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
520             done
521             SRPM_INSTALL_PATH=$BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL)
522             SRPM_LIST=$SRPM_INSTALL_PATH
523             for pkg in common undercloud; do
524                 SRPM_LIST+=" ${SRPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
525             done
526             for artifact in $RPM_LIST $SRPM_LIST; do
527               gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log 2>&1
528             done
529             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
530             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
531
532             echo
533             echo "--------------------------------------------------------"
534             echo "Done!"
535             echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
536             echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
537
538 - builder:
539     name: 'apex-deploy-virtual'
540     builders:
541         - shell: |
542             #!/bin/bash
543             set -o errexit
544             set -o nounset
545             set -o pipefail
546
547             # log info to console
548             echo "Starting the Apex virtual deployment."
549             echo "--------------------------------------------------------"
550             echo
551
552             if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
553                 # if artifact name is passed the pull a
554                 # specific artifact from artifacts.opnfv.org
555                 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
556             else
557                 if [[ $BUILD_DIRECTORY == *verify* ]]; then
558                   BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
559                   echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
560                 elif [[ $BUILD_DIRECTORY == *apex-build* ]]; then
561                   BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
562                   echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
563                 fi
564
565                 if [[ -f ${BUILD_DIRECTORY}/../opnfv.properties ]]; then
566                     # if opnfv.properties exists then use the
567                     # local build. Source the file so we get local OPNFV vars
568                     source ${BUILD_DIRECTORY}/../opnfv.properties
569                     RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL)
570                 else
571                     if [[ $BUILD_DIRECTORY == *verify* ]]; then
572                       echo "BUILD_DIRECTORY is from a verify job, so will not use latest from URL"
573                       echo "Check that the slave has opnfv.properties in $BUILD_DIRECTORY"
574                       exit 1
575                     elif [[ $BUILD_DIRECTORY == *apex-build* ]]; then
576                       echo "BUILD_DIRECTORY is from a daily job, so will not use latest from URL"
577                       echo "Check that the slave has opnfv.properties in $BUILD_DIRECTORY"
578                       exit 1
579                     fi
580                     # no opnfv.properties means use the latest from artifacts.opnfv.org
581                     # get the latest.properties to get the link to the latest artifact
582                     curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
583                     [[ -f opnfv.properties ]] || exit 1
584                     # source the file so we get OPNFV vars
585                     source opnfv.properties
586                     RPM_INSTALL_PATH=$OPNFV_RPM_URL
587                 fi
588             fi
589
590             RPM_LIST=$RPM_INSTALL_PATH
591             for pkg in common undercloud; do
592                 RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
593             done
594
595             # update / install the new rpm
596             if rpm -q opnfv-apex > /dev/null; then
597                if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
598                  echo "RPM is already installed"
599                elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
600                    if ! sudo yum downgrade -y $RPM_LIST; then
601                      sudo yum remove -y opnfv-undercloud opnfv-common
602                      sudo yum downgrade -y $RPM_INSTALL_PATH
603                    fi
604                fi
605             else
606                sudo yum install -y $RPM_LIST;
607             fi
608
609             # cleanup virtual machines before we start
610             sudo opnfv-clean
611             # initiate virtual deployment
612             if [ -e /etc/opnfv-apex/network_settings.yaml ]; then
613               if [ -n "$DEPLOY_SCENARIO" ]; then
614                 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
615                 if [ -e /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml ]; then
616                   sudo opnfv-deploy -v -d /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml -n /etc/opnfv-apex/network_settings.yaml
617                 else
618                   echo "File does not exist /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
619                   exit 1
620                 fi
621               else
622                 echo "Deploy scenario not set!"
623                 exit 1
624               fi
625             else
626               sudo opnfv-deploy -v
627             fi
628             echo
629             echo "--------------------------------------------------------"
630             echo "Done!"
631
632 - builder:
633     name: 'apex-deploy-baremetal'
634     builders:
635         - shell: |
636             #!/bin/bash
637             set -o errexit
638             set -o nounset
639             set -o pipefail
640
641             # log info to console
642             echo "Starting the Apex baremetal deployment."
643             echo "--------------------------------------------------------"
644             echo
645
646             if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
647                 # if artifact name is passed the pull a
648                 # specific artifact from artifacts.opnfv.org
649                 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
650             else
651                 if [[ $BUILD_DIRECTORY == *apex-build* ]]; then
652                   BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
653                   echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
654                 fi
655                 if [[ -f ${BUILD_DIRECTORY}/../opnfv.properties ]]; then
656                     # if opnfv.properties exists then use the
657                     # local build. Source the file so we get local OPNFV vars
658                     source ${BUILD_DIRECTORY}/../opnfv.properties
659                     RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL)
660                 else
661                     # no opnfv.properties means use the latest from artifacts.opnfv.org
662                     # get the latest.properties to get the link to the latest artifact
663                     curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
664                     [[ -f opnfv.properties ]] || exit 1
665                     # source the file so we get OPNFV vars
666                     source opnfv.properties
667                     RPM_INSTALL_PATH=$OPNFV_RPM_URL
668                 fi
669             fi
670
671             if [ ! -e "$RPM_INSTALL_PATH" ]; then
672                RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
673             fi
674
675             RPM_LIST=$RPM_INSTALL_PATH
676             for pkg in common undercloud; do
677                 RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
678             done
679
680             # update / install the new rpm
681             if rpm -q opnfv-apex > /dev/null; then
682                if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
683                  echo "RPM is already installed"
684                elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
685                    if ! sudo yum downgrade -y $RPM_LIST; then
686                      sudo yum remove -y opnfv-undercloud opnfv-common
687                      sudo yum downgrade -y $RPM_INSTALL_PATH
688                    fi
689                fi
690             else
691                sudo yum install -y $RPM_LIST;
692             fi
693
694             # cleanup environment before we start
695             sudo opnfv-clean
696             # initiate baremetal deployment
697             if [ -e /etc/opnfv-apex/network_settings.yaml ]; then
698               if [ -n "$DEPLOY_SCENARIO" ]; then
699                 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
700                 if [ -e /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml ]; then
701                   sudo opnfv-deploy -i  /root/inventory/pod_settings.yaml \
702                   -d /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml \
703                   -n /root/network/network_settings.yaml
704                 else
705                   echo "File does not exist /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
706                   exit 1
707                 fi
708               else
709                 echo "Deploy scenario not set!"
710                 exit 1
711               fi
712             else
713               echo "File /etc/opnfv-apex/network_settings.yaml does not exist!"
714               exit 1
715             fi
716
717             echo
718             echo "--------------------------------------------------------"
719             echo "Done!"
720
721 #######################
722 # trigger macros
723 ########################
724 - trigger:
725     name: 'apex-master'
726     triggers:
727         - timed: '0 3 * * *'
728 - trigger:
729     name: 'apex-brahmaputra'
730     triggers:
731         - timed: '0 6 * * 2050'