Create jobs for onap-oom-nofeature
[infra/cicd.git] / jjb / cloud-infra / onap-deploy.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_REFSPEC"
36   git fetch -q https://gerrit.nordix.org/infra/engine $ENGINE_REFSPEC && git checkout -q FETCH_HEAD
37 fi
38
39 # update scenario version and refspec in engine/envine/var/sdf.yml
40 if [[ "$DEPLOY_SCENARIO_VERSION" != "master" && "$DEPLOY_SCENARIO_REFSPEC" != "master" ]]; then
41   echo "Warning: Adding $DEPLOY_SCENARIO_VERSION as scenario version and $DEPLOY_SCENARIO_REFSPEC as scenario refspec"
42 cat << EOF > $WORKSPACE/engine/var/sdf.yml
43 scenario:
44   $DEPLOY_SCENARIO:
45     scm: git
46     src: https://gerrit.nordix.org/infra/swconfig.git
47     version: $DEPLOY_SCENARIO_VERSION
48     refspec: $DEPLOY_SCENARIO_REFSPEC
49     provisioners:
50       - $PROVISIONER_TYPE
51     installers:
52       $INSTALLER_TYPE:
53         role: scenarios/$DEPLOY_SCENARIO/$INSTALLER_TYPE/role/$DEPLOY_SCENARIO
54         distros:
55           - $DISTRO
56 EOF
57 fi
58
59 echo "Info: Starting K8S cluster creation and ONAP deployment"
60 echo "-------------------------------------------------------------------------"
61 cd $WORKSPACE
62 ./deploy.sh -c -r $PROVISIONER_TYPE -u $OPENRC_FILE \
63   -s $DEPLOY_SCENARIO -e $HEAT_ENVIRONMENT_FILE
64
65 # vim: set ts=2 sw=2 expandtab: