Bulk update to deployment
[dcaegen2/deployments.git] / archive / heat / build-plugins.sh
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # org.onap.dcae
4 # ================================================================================
5 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=========================================================
19 #
20 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
21
22 # Pull plugin archives from repos
23 # Build wagons
24 # $1 is the DCAE repo URL
25 # $2 is the CCSDK repo URL
26 # (This script runs at Docker image build time)
27 #
28 set -x
29 DEST=wagons
30
31 # For DCAE, we get zips of the archives and build wagons
32 DCAEPLUGINFILES=\
33 "\
34 k8splugin/1.4.3/k8splugin-1.4.3.tgz
35 relationshipplugin/1.0.0/relationshipplugin-1.0.0.tgz
36 dcaepolicyplugin/2.3.0/dcaepolicyplugin-2.3.0.tgz 
37 dockerplugin/3.2.0/dockerplugin-3.2.0.tgz \
38 "
39
40 # For CCSDK, we pull down the wagon files directly
41 CCSDKPLUGINFILES=\
42 "\
43 plugins/pgaas-1.1.0-py27-none-any.wgn
44 plugins/sshkeyshare-1.0.0-py27-none-any.wgn
45 "
46
47 # Build a set of wagon files from archives in a repo
48 # $1 -- repo base URL
49 # $2 -- list of paths to archive files in the repo
50 function build {
51         for plugin in $2
52         do
53                 # Could just do wagon create with the archive URL as source,
54                 # but can't use a requirements file with that approach
55                 mkdir work
56                 target=$(basename ${plugin})
57                 curl -Ss $1/${plugin} > ${target}
58                 tar zxvf ${target} --strip-components=2 -C work
59                 wagon create -t tar.gz -o ${DEST}  -r work/requirements.txt --validate ./work
60                 rm -rf work
61         done
62 }
63
64 # Copy a set of wagons from a repo
65 # $1 -- repo baseURL
66 # $2 -- list of paths to wagons in the repo
67 function get_wagons {
68         for wagon in $2
69         do
70                 target=$(basename ${wagon})
71                 curl -Ss $1/${wagon} > ${DEST}/${target}
72         done
73 }
74
75 mkdir ${DEST}
76 build $1 "${DCAEPLUGINFILES}"
77 get_wagons $2 "${CCSDKPLUGINFILES}"