blob: 5162832cc89d5e5e7d253c647d5655f754654780 [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.
Jack Lucasbc4f7b82020-12-04 14:27:11 -05004# Copyright (d) 2020-2021 J. F. Lucas. All rights reserved.
Jack Lucasec3410a2020-05-18 18:23:38 -04005# ================================================================================
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#
23set -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
27DEST=${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
31PLUGINS=\
32"\
Jack Lucasbc4f7b82020-12-04 14:27:11 -050033/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.5.1/k8splugin-3.5.1-py36-none-linux_x86_64.wgn|/k8splugin/3.5.1/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
Jack Lucasec3410a2020-05-18 18:23:38 -040040"
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}