Initial commit of seed code
[it/dep.git] / localize.sh
1 #!/bin/bash
2 ################################################################################
3 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
4 #   Copyright (c) 2019 Nokia.                                                  #
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
19 source ./runric_env.sh
20 if [ -z $__RICENV_SET__ ]; then
21   echo "Edit your ric_env.sh for local infrastyructure values first"
22   exit
23 fi
24
25 echo "Copy files to generated fir"
26 DIRS='kubernetes ricplt xapps'
27 rm -rf ./generated
28 mkdir -p generated
29 for d in $DIRS; do
30   cp -rf $d ./generated/
31 done
32
33 echo "env substitude vars in .yaml and .sh files"
34 FILELIST=$(find .  \( -name "*.sh" -o -name "*.yaml" \))
35 for f in $FILELIST; do
36   echo "$f to ./generated/$f":
37   envsubst '${__RUNRICENV_GERRIT_HOST__}
38 ${__RUNRICENV_GERRIT_IP__}
39 ${__RUNRICENV_DOCKER_HOST__}
40 ${__RUNRICENV_DOCKER_IP__}
41 ${__RUNRICENV_DOCKER_PORT__}
42 ${__RUNRICENV_DOCKER_USER__}
43 ${__RUNRICENV_DOCKER_PASS__}
44 ${__RUNRICENV_HELMREPO_HOST__}
45 ${__RUNRICENV_HELMREPO_PORT__}
46 ${__RUNRICENV_HELMREPO_IP__}
47 ${__RUNRICENV_HELMREPO_USER__}
48 ${__RUNRICENV_HELMREPO_PASS__} '< $f > "./generated/$f";
49 done
50
51