armada-app: fix build failure on centos
[pti/rtp.git] / meta-stx / recipes-core / stx-openstack-armada-app / stx-openstack-helm_1.0.bb
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 SUMMARY = "StarlingX Openstack Application Helm charts"
17 DESCRIPTION = "StarlingX Openstack Application Helm charts"
18
19 LICENSE = "Apache-2.0"
20 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
21
22 DEPENDS += " \
23     helm-native \
24     openstack-helm \
25     openstack-helm-infra \
26     stx-platform-helm \
27 "
28
29 PROTOCOL = "https"
30 BRANCH = "r/stx.3.0"
31 SRCREV = "863f4b9733d3d4f4fd490606a94b84cfdaf2df2c"
32
33 SRC_URI = "git://opendev.org/starlingx/openstack-armada-app;protocol=${PROTOCOL};branch=${BRANCH}"
34
35 S = "${WORKDIR}/git/stx-openstack-helm/stx-openstack-helm"
36
37 inherit allarch
38
39 helm_folder = "${nonarch_libdir}/helm"
40 armada_folder = "${nonarch_libdir}/armada"
41 app_folder = "${nonarch_libdir}/application"
42 toolkit_version = "0.1.0"
43 helmchart_version = "0.1.0"
44
45 do_configure () {
46         :
47 }
48
49 do_compile () {
50         # initialize helm and build the toolkit
51         # helm init --client-only does not work if there is no networking
52         # The following commands do essentially the same as: helm init
53         export HOME="${B}/${USER}"
54         export helm_home="${B}/${USER}/.helm"
55         rm -rf ${helm_home}
56
57         mkdir -p ${helm_home}
58         mkdir ${helm_home}/repository
59         mkdir ${helm_home}/repository/cache
60         mkdir ${helm_home}/repository/local
61         mkdir ${helm_home}/plugins
62         mkdir ${helm_home}/starters
63         mkdir ${helm_home}/cache
64         mkdir ${helm_home}/cache/archive
65
66         # Stage a repository file that only has a local repo
67         cp ${S}/files/repositories.yaml ${helm_home}/repository/repositories.yaml
68
69         # Stage a local repo index that can be updated by the build
70         cp ${S}/files/index.yaml ${helm_home}/repository/local/index.yaml
71
72         # Stage helm-toolkit in the local repo
73         cp ${RECIPE_SYSROOT}${helm_folder}/helm-toolkit-${toolkit_version}.tgz .
74
75         # Host a server for the charts
76         helm serve --repo-path . &
77         sleep 1
78         helm repo rm local
79         helm repo add local http://localhost:8879/charts
80
81         # Make the charts. These produce a tgz file
82         cd ${S}/helm-charts
83         make nova-api-proxy
84         make garbd
85         make keystone-api-proxy
86         make fm-rest-api
87         make nginx-ports-control
88         make dcdbsync
89         cd -
90
91         # terminate helm server (the last backgrounded task)
92         kill $!
93         rm -rf ${helm_home}
94
95         # Remove the helm-toolkit tarball
96         rm helm-toolkit-${toolkit_version}.tgz
97 }
98
99 do_install () {
100         install -d -m 755 ${D}${app_folder}
101         install -p -D -m 755 ${S}/files/metadata.yaml ${D}${app_folder}
102         install -d -m 755 ${D}${helm_folder}
103         install -p -D -m 755 ${S}/helm-charts/*.tgz ${D}${helm_folder}
104         install -d -m 755 ${D}${armada_folder}
105         install -p -D -m 755 ${S}/manifests/*.yaml ${D}${armada_folder}
106 }
107
108 FILES_${PN} = " \
109     ${app_folder} \
110     ${helm_folder} \
111     ${armada_folder} \
112 "
113
114 RDEPENDS_${PN} = " \
115     helm \
116     openstack-helm \
117     openstack-helm-infra \
118 "