CM 4.4.2 with K8splugin 3.8.0
[dcaegen2/deployments.git] / cm-container / scripts / get-plugins.sh
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
4 # Copyright (d) 2020-2021 J. F. Lucas.  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 # ============LICENSE_END=========================================================
18
19 # Pull plugin wagon files and type files from repo
20 # $1 is the DCAE repo URL - script assumes all files come from the
21 #    same repo, but not necessarily same paths
22 #
23 set -x -e
24
25 # Location in CM container where plugins/type files will be stored
26 # At deployment, CM script will look here to find plugins to upload
27 DEST=${DEST:-/opt/plugins}
28
29 # Each line has a plugin wagon/type file pair, in the form
30 # /path/to/plugin/wagon|/path/to/type/file
31 PLUGINS=\
32 "\
33 /dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py36-none-linux_x86_64.wgn|/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml \
34 /relationshipplugin/1.1.0/relationshipplugin-1.1.0-py36-none-linux_x86_64.wgn|/relationshipplugin/1.1.0/relationshipplugin_types.yaml \
35 /k8splugin/3.8.0/k8splugin-3.8.0-py36-none-linux_x86_64.wgn|/k8splugin/3.8.0/k8splugin_types.yaml \
36 /clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py36-none-linux_x86_64.wgn|/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \
37 /dmaap/1.5.0/dmaap-1.5.0-py36-none-linux_x86_64.wgn|/dmaap/1.5.0/dmaap_types.yaml \
38 /pgaas/1.3.0/pgaas-1.3.0-py36-none-linux_x86_64.wgn|/pgaas/1.3.0/pgaas_types.yaml \
39 /sshkeyshare/1.2.0/sshkeyshare-1.2.0-py36-none-linux_x86_64.wgn|/sshkeyshare/1.2.0/sshkeyshare_types.yaml
40 "
41
42 mkdir -p ${DEST}
43
44 for p in ${PLUGINS}
45 do
46   w=$(echo $p | cut -d '|' -f1)
47   t=$(echo $p | cut -d '|' -f2)
48
49   # Put each wagon/type file pair into its own subdirectory
50   # This prevents name collisions which can happen because
51   # type files don't embed a version.
52         subdir=$(mktemp -d -t plugin-XXXXXXX --tmpdir=${DEST})
53
54         curl -Ss -L -f $1/$t >> ${subdir}/$(basename $t)
55   curl -Ss -L -f $1/$w >> ${subdir}/$(basename $w)
56
57 done
58
59 chown -R cfyuser:cfyuser ${DEST}