Bulk update to deployment
[dcaegen2/deployments.git] / k8s-bootstrap-container / build-plugins.sh
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # org.onap.dcae
4 # ================================================================================
5 # Copyright (c) 2018-2019 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 # 2 versions of k8s plugin to ease transition
33 DCAEPLUGINFILES=\
34 "\
35 k8splugin/1.4.5/k8splugin-1.4.5.tgz
36 k8splugin/1.4.12/k8splugin-1.4.12.tgz
37 relationshipplugin/1.0.0/relationshipplugin-1.0.0.tgz
38 dcaepolicyplugin/2.3.0/dcaepolicyplugin-2.3.0.tgz \
39 "
40
41 # For CCSDK, we pull down the wagon files directly
42 CCSDKPLUGINFILES=\
43 "\
44 plugins/pgaas-1.1.0-py27-none-any.wgn
45 plugins/dmaap-1.3.2-py27-none-any.wgn
46 plugins/sshkeyshare-1.0.0-py27-none-any.wgn
47 plugins/helm-4.0.0-py27-none-linux_x86_64.wgn
48 "
49
50 # Build a set of wagon files from archives in a repo
51 # $1 -- repo base URL
52 # $2 -- list of paths to archive files in the repo
53 function build {
54         for plugin in $2
55         do
56                 # Could just do wagon create with the archive URL as source,
57                 # but can't use a requirements file with that approach
58                 mkdir work
59                 target=$(basename ${plugin})
60                 curl -Ss $1/${plugin} > ${target}
61                 tar zxvf ${target} --strip-components=2 -C work
62                 wagon create -t tar.gz -o ${DEST}  -r work/requirements.txt --validate ./work
63                 rm -rf work
64         done
65 }
66
67 # Copy a set of wagons from a repo
68 # $1 -- repo baseURL
69 # $2 -- list of paths to wagons in the repo
70 function get_wagons {
71         for wagon in $2
72         do
73                 target=$(basename ${wagon})
74                 curl -Ss $1/${wagon} > ${DEST}/${target}
75         done
76 }
77
78 mkdir ${DEST}
79 build $1 "${DCAEPLUGINFILES}"
80 get_wagons $2 "${CCSDKPLUGINFILES}"