blob: 5d112549a77bd872550f2fd2653dd6929111849e [file] [log] [blame]
Jack Lucasec3410a2020-05-18 18:23:38 -04001#!/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#
22set -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
26DEST=${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
30PLUGINS=\
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 \
JerzySzachniewicz7c9b34c2020-12-17 09:23:24 +010034/k8splugin/3.5.1/k8splugin-3.5.1-py27-none-linux_x86_64.wgn|/k8splugin/3.5.1/k8splugin_types.yaml \
Jack Lucasec3410a2020-05-18 18:23:38 -040035/clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn|/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \
36/dmaap/1.5.0/dmaap-1.5.0-py27-none-linux_x86_64.wgn|/dmaap/1.5.0/dmaap_types.yaml \
37/helm/4.2.0/helm-4.2.0-py27-none-linux_x86_64.wgn|/helm/4.2.0/helm_types.yaml \
38/pgaas/1.3.0/pgaas-1.3.0-py27-none-linux_x86_64.wgn|/pgaas/1.3.0/pgaas_types.yaml \
39/sshkeyshare/1.2.0/sshkeyshare-1.2.0-py27-none-linux_x86_64.wgn|/sshkeyshare/1.2.0/sshkeyshare_types.yaml
40"
41
42mkdir -p ${DEST}
43
44for p in ${PLUGINS}
45do
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
57done
58
59chown -R cfyuser:cfyuser ${DEST}