summaryrefslogtreecommitdiffstats
path: root/cm-container/scripts/get-plugins.sh
blob: 7c2f353eec4fa9f36c71035e7d382e81a23b4c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# ============LICENSE_START=======================================================
# Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================

# Pull plugin wagon files and type files from repo
# $1 is the DCAE repo URL - script assumes all files come from the
#    same repo, but not necessarily same paths
#
set -x -e

# Location in CM container where plugins/type files will be stored
# At deployment, CM script will look here to find plugins to upload
DEST=${DEST:-/opt/plugins}

# Each line has a plugin wagon/type file pair, in the form
# /path/to/plugin/wagon|/path/to/type/file
PLUGINS=\
"\
/dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py27-none-linux_x86_64.wgn|/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml \
/relationshipplugin/1.1.0/relationshipplugin-1.1.0-py27-none-linux_x86_64.wgn|/relationshipplugin/1.1.0/relationshipplugin_types.yaml \
/k8splugin/2.0.0/k8splugin-2.0.0-py27-none-linux_x86_64.wgn|/k8splugin/2.0.0/k8splugin_types.yaml \
/k8splugin/3.0.0/k8splugin-3.0.0-py27-none-linux_x86_64.wgn|/k8splugin/3.0.0/k8splugin_types.yaml \
/clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn|/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \
/dmaap/1.5.0/dmaap-1.5.0-py27-none-linux_x86_64.wgn|/dmaap/1.5.0/dmaap_types.yaml \
/helm/4.2.0/helm-4.2.0-py27-none-linux_x86_64.wgn|/helm/4.2.0/helm_types.yaml \
/pgaas/1.3.0/pgaas-1.3.0-py27-none-linux_x86_64.wgn|/pgaas/1.3.0/pgaas_types.yaml \
/sshkeyshare/1.2.0/sshkeyshare-1.2.0-py27-none-linux_x86_64.wgn|/sshkeyshare/1.2.0/sshkeyshare_types.yaml
"

mkdir -p ${DEST}

for p in ${PLUGINS}
do
  w=$(echo $p | cut -d '|' -f1)
  t=$(echo $p | cut -d '|' -f2)

  # Put each wagon/type file pair into its own subdirectory
  # This prevents name collisions which can happen because
  # type files don't embed a version.
	subdir=$(mktemp -d -t plugin-XXXXXXX --tmpdir=${DEST})

	curl -Ss -L -f $1/$t >> ${subdir}/$(basename $t)
  curl -Ss -L -f $1/$w >> ${subdir}/$(basename $w)

done

chown -R cfyuser:cfyuser ${DEST}