R7 tag/path update
[dcaegen2/deployments.git] / cm-container / scripts / get-type-files.sh
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # org.onap.dcae
4 # ================================================================================
5 # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=========================================================
19
20 # Pull type files from repos
21 # Set up the CM import resolver
22 # $1 is the DCAE repo URL
23 # $2 is the CCSDK repo URL
24 #
25 set -x
26 DEST=/opt/manager/resources/onapspec
27 EXTRA_RULES=/opt/manager/extra-resolver-rules
28
29 DCAETYPEFILES=\
30 "\
31 /dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml \
32 /relationshipplugin/1.1.0/relationshipplugin_types.yaml \
33 /k8splugin/1.7.2/k8splugin_types.yaml \
34 /k8splugin/2.0.0/k8splugin_types.yaml \
35 clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \
36
37 "
38
39 CCSDKTYPEFILES=\
40 "\
41 /type_files/pgaas/1.1.0/pgaas_types.yaml \
42 /type_files/sshkeyshare/sshkey_types.yaml \
43 /type_files/helm/4.0.2/helm-type.yaml \
44 /type_files/dmaap/dmaap.yaml \
45 "
46
47 mkdir ${DEST}
48
49 for typefile in ${DCAETYPEFILES}
50 do
51         mkdir -p ${DEST}/$(dirname ${typefile})
52         curl -Ss -L -f $1/${typefile} >> ${DEST}/${typefile}
53 done
54
55 for typefile in ${CCSDKTYPEFILES}
56 do
57         mkdir -p ${DEST}/$(dirname ${typefile})
58         curl -Ss -L -f $2/${typefile} >> ${DEST}/${typefile}
59 done
60
61 chown cfyuser:cfyuser ${DEST}
62
63 # Add our local type file store to CM import resolver configuration
64 TYPE_RULE0="{\"$1\": \"file://${DEST}\"}"
65 TYPE_RULE1="{\"$2\": \"file://${DEST}\"}"
66 # This sed re is 'brittle' but we can be sure the config.yaml file
67 # won't change as long as we do not change the source Docker image for CM
68 sed -i -e "s#      rules:#      rules:\n      - ${TYPE_RULE0}#" /etc/cloudify/config.yaml
69 sed -i -e "s#      rules:#      rules:\n      - ${TYPE_RULE1}#" /etc/cloudify/config.yaml
70
71 chown cfyuser:cfyuser /etc/cloudify/config.yaml
72
73 # Changing /etc/cloudify/config.yaml is no longer sufficient
74 # Need to provide the additional rules in a file that can be
75 # used at deployment time to update the resolver rules
76 echo "- ${TYPE_RULE0}" > ${EXTRA_RULES}
77 echo "- ${TYPE_RULE1}" >> ${EXTRA_RULES}