Update cm-container with k8splugin 3.4.1
[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 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
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,
13 # WITHOUT 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 # ============LICENSE_END=========================================================
17
18 # Pull plugin wagon files and type files from repo
19 # $1 is the DCAE repo URL - script assumes all files come from the
20 #    same repo, but not necessarily same paths
21 #
22 set -x -e
23
24 # Location in CM container where plugins/type files will be stored
25 # At deployment, CM script will look here to find plugins to upload
26 DEST=${DEST:-/opt/plugins}
27
28 # Each line has a plugin wagon/type file pair, in the form
29 # /path/to/plugin/wagon|/path/to/type/file
30 PLUGINS=\
31 "\
32 /dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py27-none-linux_x86_64.wgn|/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml \
33 /relationshipplugin/1.1.0/relationshipplugin-1.1.0-py27-none-linux_x86_64.wgn|/relationshipplugin/1.1.0/relationshipplugin_types.yaml \
34 /k8splugin/2.0.0/k8splugin-2.0.0-py27-none-linux_x86_64.wgn|/k8splugin/2.0.0/k8splugin_types.yaml \
35 /k8splugin/3.0.0/k8splugin-3.0.0-py27-none-linux_x86_64.wgn|/k8splugin/3.0.0/k8splugin_types.yaml \
36 /k8splugin/3.3.0/k8splugin-3.3.0-py27-none-linux_x86_64.wgn|/k8splugin/3.3.0/k8splugin_types.yaml \
37 /k8splugin/3.4.1/k8splugin-3.4.1-py27-none-linux_x86_64.wgn|/k8splugin/3.4.1/k8splugin_types.yaml \
38 /clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn|/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \
39 /dmaap/1.5.0/dmaap-1.5.0-py27-none-linux_x86_64.wgn|/dmaap/1.5.0/dmaap_types.yaml \
40 /helm/4.2.0/helm-4.2.0-py27-none-linux_x86_64.wgn|/helm/4.2.0/helm_types.yaml \
41 /pgaas/1.3.0/pgaas-1.3.0-py27-none-linux_x86_64.wgn|/pgaas/1.3.0/pgaas_types.yaml \
42 /sshkeyshare/1.2.0/sshkeyshare-1.2.0-py27-none-linux_x86_64.wgn|/sshkeyshare/1.2.0/sshkeyshare_types.yaml
43 "
44
45 mkdir -p ${DEST}
46
47 for p in ${PLUGINS}
48 do
49   w=$(echo $p | cut -d '|' -f1)
50   t=$(echo $p | cut -d '|' -f2)
51
52   # Put each wagon/type file pair into its own subdirectory
53   # This prevents name collisions which can happen because
54   # type files don't embed a version.
55         subdir=$(mktemp -d -t plugin-XXXXXXX --tmpdir=${DEST})
56
57         curl -Ss -L -f $1/$t >> ${subdir}/$(basename $t)
58   curl -Ss -L -f $1/$w >> ${subdir}/$(basename $w)
59
60 done
61
62 chown -R cfyuser:cfyuser ${DEST}