Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-core / stx-monitor-armada-app / monitor-helm-elastic_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 = "Monitor Helm Elastic charts"
17 DESCRIPTION = "Monitor Helm Elastic 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     stx-openstack-helm \
25 "
26
27 PROTOCOL = "https"
28 BRANCH = "r/stx.3.0"
29 SRCREV_helm-charts-elastic = "2bd7616ceddbdf2eee88965e2028ee37d304c79c"
30 SRCREV_monitor-armada-app = "e5ee6b3a07b74479b93fe90eff0662cf81890f73"
31
32 SRC_URI = " \
33     git://github.com/elastic/helm-charts;protocol=${PROTOCOL};name=helm-charts-elastic \
34     git://opendev.org/starlingx/monitor-armada-app.git;protocol=${PROTOCOL};branch=${BRANCH};name=monitor-armada-app;destsuffix=monitor-armada-app \
35 "
36
37 S = "${WORKDIR}/git"
38
39 inherit allarch
40
41 patch_folder = "${WORKDIR}/monitor-armada-app/monitor-helm-elastic/files"
42 helm_folder = "${nonarch_libdir}/helm"
43 helmchart_version = "0.1.0"
44
45 do_patch () {
46         cd ${S}
47         git am ${patch_folder}/0001-add-makefile.patch
48         git am ${patch_folder}/0002-Add-compatibility-for-k8s-1.16.patch
49         git am ${patch_folder}/0003-use-oss-image.patch
50         git am ${patch_folder}/0004-Update-to-Elastic-7.4.0-Release.patch
51         git am ${patch_folder}/0005-set-initial-masters-to-master-0.patch
52 }
53
54 do_configure () {
55         :
56 }
57
58 do_compile () {
59         # initialize helm and build the toolkit
60         # helm init --client-only does not work if there is no networking
61         # The following commands do essentially the same as: helm init
62         export HOME="${B}/${USER}"
63         export helm_home="${B}/${USER}/.helm"
64         rm -rf ${helm_home}
65
66         mkdir -p ${helm_home}
67         mkdir ${helm_home}/repository
68         mkdir ${helm_home}/repository/cache
69         mkdir ${helm_home}/repository/local
70         mkdir ${helm_home}/plugins
71         mkdir ${helm_home}/starters
72         mkdir ${helm_home}/cache
73         mkdir ${helm_home}/cache/archive
74
75         # Stage a repository file that only has a local repo
76         install -m 0644 ${patch_folder}/repositories.yaml \
77                 ${helm_home}/repository/repositories.yaml
78
79         # Stage a local repo index that can be updated by the build
80         install -m 0644 ${patch_folder}/index.yaml ${helm_home}/repository/local/index.yaml
81
82         # Host a server for the charts
83         helm serve --repo-path . &
84         helm repo rm local
85         helm repo add local http://localhost:8879/charts
86
87         # Create the tgz files
88         rm -rf elasticsearch/Makefile
89         make elasticsearch
90
91         # terminate helm server
92         pid=`/bin/pidof helm`
93         kill ${pid}
94         rm -rf ${helm_home}
95 }
96
97 do_install () {
98         install -d -m 755 ${D}${helm_folder}
99         install -p -D -m 755 ${B}/*.tgz ${D}${helm_folder}
100 }
101
102 FILES_${PN} = "${helm_folder}"
103
104 RDEPENDS_${PN} = " \
105     helm \
106     stx-platform-helm \
107     stx-openstack-helm \
108 "