Fatih Degirmenci | aadea7b | 2019-07-29 21:19:42 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # ============LICENSE_START======================================================= |
| 4 | # Copyright (C) 2019 The Nordix Foundation. All rights reserved. |
| 5 | # ================================================================================ |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ============LICENSE_END========================================================= |
| 20 | |
| 21 | set -o errexit |
| 22 | set -o nounset |
| 23 | |
| 24 | cd $WORKSPACE |
Fatih Degirmenci | c01b6d5 | 2019-07-30 13:51:09 +0200 | [diff] [blame] | 25 | /bin/rm -f ../inventory.ini |
Fatih Degirmenci | aadea7b | 2019-07-29 21:19:42 +0200 | [diff] [blame] | 26 | echo "Info: Preparing for ONAP deployment" |
| 27 | |
| 28 | # checkout given engine version |
| 29 | if [[ "$ENGINE_VERSION" != "master" ]]; then |
| 30 | echo "Warning: Checking out $ENGINE_VERSION" |
| 31 | git checkout -q $ENGINE_VERSION |
| 32 | fi |
| 33 | |
| 34 | # checkout given engine refspec |
| 35 | if [[ "$ENGINE_REFSPEC" != "master" ]]; then |
Fatih Degirmenci | 0d46475 | 2019-07-30 12:14:02 +0200 | [diff] [blame] | 36 | echo "Warning: Checking out engine $ENGINE_REFSPEC" |
| 37 | echo "-------------------------------------------------------------------------" |
| 38 | git fetch https://gerrit.nordix.org/infra/engine $ENGINE_REFSPEC && git checkout -q FETCH_HEAD |
| 39 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | aadea7b | 2019-07-29 21:19:42 +0200 | [diff] [blame] | 40 | fi |
| 41 | |
| 42 | # update scenario version and refspec in engine/envine/var/sdf.yml |
| 43 | if [[ "$DEPLOY_SCENARIO_VERSION" != "master" && "$DEPLOY_SCENARIO_REFSPEC" != "master" ]]; then |
| 44 | echo "Warning: Adding $DEPLOY_SCENARIO_VERSION as scenario version and $DEPLOY_SCENARIO_REFSPEC as scenario refspec" |
| 45 | cat << EOF > $WORKSPACE/engine/var/sdf.yml |
| 46 | scenario: |
| 47 | $DEPLOY_SCENARIO: |
| 48 | scm: git |
| 49 | src: https://gerrit.nordix.org/infra/swconfig.git |
| 50 | version: $DEPLOY_SCENARIO_VERSION |
| 51 | refspec: $DEPLOY_SCENARIO_REFSPEC |
| 52 | provisioners: |
| 53 | - $PROVISIONER_TYPE |
| 54 | installers: |
| 55 | $INSTALLER_TYPE: |
| 56 | role: scenarios/$DEPLOY_SCENARIO/$INSTALLER_TYPE/role/$DEPLOY_SCENARIO |
| 57 | distros: |
| 58 | - $DISTRO |
| 59 | EOF |
Fatih Degirmenci | f3afb6d | 2019-07-29 22:27:40 +0200 | [diff] [blame] | 60 | |
| 61 | echo "Info: Temporary SDF content" |
| 62 | echo "-------------------------------------------------------------------------" |
| 63 | cat $WORKSPACE/engine/var/sdf.yml |
| 64 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | aadea7b | 2019-07-29 21:19:42 +0200 | [diff] [blame] | 65 | fi |
| 66 | |
| 67 | echo "Info: Starting K8S cluster creation and ONAP deployment" |
| 68 | echo "-------------------------------------------------------------------------" |
| 69 | cd $WORKSPACE |
Fatih Degirmenci | 0a2e213 | 2020-03-06 21:57:58 +0100 | [diff] [blame] | 70 | ./engine/deploy.sh -r $PROVISIONER_TYPE -u /tmp/openrc \ |
Fatih Degirmenci | aadea7b | 2019-07-29 21:19:42 +0200 | [diff] [blame] | 71 | -s $DEPLOY_SCENARIO -e $HEAT_ENVIRONMENT_FILE |
| 72 | |
Fatih Degirmenci | c01b6d5 | 2019-07-30 13:51:09 +0200 | [diff] [blame] | 73 | cd $WORKSPACE |
Fatih Degirmenci | 108bf44 | 2020-01-08 10:28:24 +0100 | [diff] [blame] | 74 | /bin/cp /opt/engine/.cache/config/inventory.ini ../inventory.ini |
Fatih Degirmenci | aadea7b | 2019-07-29 21:19:42 +0200 | [diff] [blame] | 75 | # vim: set ts=2 sw=2 expandtab: |