45284423b58d776e66b7329dd2b7a74050074b8f
[yaml_builds.git] / tools / generate_yamls.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright © 2018 AT&T Intellectual Property. All rights reserved.          #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may    #
6 # not use this file except in compliance with the License.                   #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
9 #       http://www.apache.org/licenses/LICENSE-2.0                           #
10 #                                                                            #
11 # Unless required by applicable law or agreed to in writing, software        #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18
19 source $(dirname $0)/setenv.sh
20
21 if [ -z "$AIC_CLCP_MANIFESTS" ]
22 then
23   echo "Please follow https://codecloud.web.att.com/projects/ST_CCP/repos/aic-clcp-manifests/browse/docs/source/deployment_blueprint.md to clone aic-clcp-manifests. Also export AIC_CLCP_MANIFESTS to it."
24   exit -1
25 fi
26
27 if [ -z "$AIC_CLCP_SECURITY_MANIFESTS" ]
28 then
29   echo "Please follow https://codecloud.web.att.com/projects/ST_CCP/repos/aic-clcp-manifests/browse/docs/source/deployment_blueprint.md to clone aic-clcp-security-manifests. Also export AIC_CLCP_SECURITY_MANIFESTS to it."
30   exit -1
31 fi
32
33 if [ -z "$1" ]
34 then
35   echo "Plese pass site name as command line argument"
36   exit -2
37 else
38   SITE=${SITE:-$1}
39   echo "SITE=$SITE"
40 fi
41
42 cd $YAML_BUILDS
43 python ./scripts/jcopy.py $SITE.yaml ./templates/aic-clcp-manifests $AIC_CLCP_MANIFESTS/site/$SITE
44 python ./scripts/jcopy.py $SITE.yaml ./templates/aic-clcp-security-manifests $AIC_CLCP_SECURITY_MANIFESTS/site/$SITE
45 python ./scripts/jcopy.py $SITE.yaml ./templates/yaml_builds/set_site_env.sh ./tools/
46 mv ./tools/set_site_env.sh ./tools/env_$SITE.sh