3b982b51c1306ab1b42f3f7dd6cda907b0385d94
[infra/cicd.git] / jjb / cloud-infra / onap-deploy-baremetal.sh
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
25 echo "Info: Preparing for ONAP deployment"
26
27 # checkout given engine version
28 if [[ "$ENGINE_VERSION" != "master" ]]; then
29   echo "Warning: Checking out $ENGINE_VERSION"
30   git checkout -q $ENGINE_VERSION
31 fi
32
33 # checkout given engine refspec
34 if [[ "$ENGINE_REFSPEC" != "master" ]]; then
35   echo "Warning: Checking out engine $ENGINE_REFSPEC"
36   echo "-------------------------------------------------------------------------"
37   git fetch https://gerrit.nordix.org/infra/engine $ENGINE_REFSPEC && git checkout -q FETCH_HEAD
38   echo "-------------------------------------------------------------------------"
39 fi
40
41 # update scenario version and refspec in engine/envine/var/sdf.yml
42 if [[ "$DEPLOY_SCENARIO_VERSION" != "master" && "$DEPLOY_SCENARIO_REFSPEC" != "master" ]]; then
43   echo "Warning: Adding $DEPLOY_SCENARIO_VERSION as scenario version and $DEPLOY_SCENARIO_REFSPEC as scenario refspec"
44 cat << EOF > $WORKSPACE/engine/var/sdf.yml
45 scenario:
46   $DEPLOY_SCENARIO:
47     scm: git
48     src: https://gerrit.nordix.org/infra/swconfig.git
49     version: $DEPLOY_SCENARIO_VERSION
50     refspec: $DEPLOY_SCENARIO_REFSPEC
51     provisioners:
52       - $PROVISIONER_TYPE
53     installers:
54       $INSTALLER_TYPE:
55         role: scenarios/$DEPLOY_SCENARIO/$INSTALLER_TYPE/role/$DEPLOY_SCENARIO
56         distros:
57           - $DISTRO
58 EOF
59
60   echo "Info: Temporary SDF content"
61   echo "-------------------------------------------------------------------------"
62   cat $WORKSPACE/engine/var/sdf.yml
63   echo "-------------------------------------------------------------------------"
64 fi
65
66 echo "Info: Starting K8S cluster creation and ONAP deployment"
67 echo "-------------------------------------------------------------------------"
68 cd $WORKSPACE
69 ./engine/deploy.sh -d $INSTALLER_TYPE -r $PROVISIONER_TYPE -s $DEPLOY_SCENARIO -v \
70     -p "https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/${NODE_NAME}-pdf.yml" \
71     -i "https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/${NODE_NAME}-idf.yml"
72
73 cd $WORKSPACE
74 /bin/cp -f /opt/engine/.cache/config/inventory.ini ../inventory.ini || true
75 /bin/cp -f /opt/engine/.cache/config/inventory.ini /tmp/inventory.ini || true
76 # vim: set ts=2 sw=2 expandtab: