Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-flock / stx-platform-armada-app / stx-platform-helm_1.0.bb
1
2 SUMMARY = "StarlingX Platform Helm charts"
3 DESCRIPTION = "StarlingX Platform Helm charts"
4
5 LICENSE = "Apache-2.0"
6 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
7
8 DEPENDS += " \
9     helm-native \
10     openstack-helm \
11     openstack-helm-infra \
12 "
13
14 PROTOCOL = "https"
15 BRANCH = "r/stx.3.0"
16 SRCREV_platform-armada-app = "c67d1eeb605ea1da4ebb2a1219a6f54f05e3eb5e"
17 SRCREV_helm-charts = "c01426a2500269fbf1a781214a361de0796297d1"
18
19 SRC_URI = " \
20     git://opendev.org/starlingx/platform-armada-app.git;protocol=${PROTOCOL};branch=${BRANCH};name=platform-armada-app \
21     git://opendev.org/starlingx/helm-charts.git;protocol=${PROTOCOL};branch=${BRANCH};name=helm-charts;destsuffix=helm-charts \
22 "
23
24 S = "${WORKDIR}/git/stx-platform-helm/stx-platform-helm"
25
26 inherit allarch
27
28 toolkit_version = "0.1.0"
29 helm_folder = "${RECIPE_SYSROOT}${nonarch_libdir}/helm"
30 helm_repo = "stx-platform"
31
32 app_name = "platform-integ-apps"
33 app_staging = "${B}/staging"
34 app_tarball = "${app_name}.tgz"
35 app_folder = "/usr/local/share/applications/helm"
36
37 do_configure[noexec] = "1"
38
39 do_compile () {
40         # initialize helm and build the toolkit
41         # helm init --client-only does not work if there is no networking
42         # The following commands do essentially the same as: helm init
43         export HOME="${B}/${USER}"
44         export helm_home="${B}/${USER}/.helm"
45         rm -rf ${helm_home}
46
47         mkdir  -p ${helm_home}
48         mkdir  ${helm_home}/repository
49         mkdir  ${helm_home}/repository/cache
50         mkdir  ${helm_home}/repository/local
51         mkdir  ${helm_home}/plugins
52         mkdir  ${helm_home}/starters
53         mkdir  ${helm_home}/cache
54         mkdir  ${helm_home}/cache/archive
55
56         # Stage a repository file that only has a local repo
57         cp ${S}/files/repositories.yaml ${helm_home}/repository/repositories.yaml
58
59         # Stage a local repo index that can be updated by the build
60         cp ${S}/files/index.yaml ${helm_home}/repository/local/index.yaml
61
62         # Stage helm-toolkit in the local repo
63         cp ${helm_folder}/helm-toolkit-${toolkit_version}.tgz ${S}/helm-charts/
64
65         # Host a server for the charts
66         helm serve --repo-path . &
67         sleep 1
68         helm repo rm local
69         helm repo add local http://localhost:8879/charts
70
71         # Make the charts. These produce a tgz file
72         cp -rf ${WORKDIR}/helm-charts/node-feature-discovery/node-feature-discovery/helm-charts/node-feature-discovery/ \
73                 ${S}/helm-charts/
74         cd ${S}/helm-charts
75         make rbd-provisioner
76         make ceph-pools-audit
77         make node-feature-discovery
78         cd -
79
80         # Terminate helm server (the last backgrounded task)
81         kill $!
82         rm -rf ${helm_home}
83
84         # Create a chart tarball compliant with sysinv kube-app.py
85         # Setup staging
86         mkdir -p ${app_staging}
87         cp ${S}/files/metadata.yaml ${app_staging}
88         cp ${S}/manifests/manifest.yaml ${app_staging}
89
90         mkdir -p ${app_staging}/charts
91         cp ${S}/helm-charts/*.tgz ${app_staging}/charts
92         cd ${app_staging}
93
94         # Populate metadata
95         sed -i 's/@APP_NAME@/${app_name}/g' ${app_staging}/metadata.yaml
96         sed -i 's/@APP_VERSION@/${version}-${tis_patch_ver}/g' ${app_staging}/metadata.yaml
97         sed -i 's/@HELM_REPO@/${helm_repo}/g' ${app_staging}/metadata.yaml
98
99         # package it up
100         find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
101         tar -zcf ${B}/${app_tarball} -C ${app_staging}/ .
102
103         # Cleanup staging
104         rm -fr ${app_staging}
105 }
106
107 do_install () {
108         install -d -m 755 ${D}/${app_folder}
109         install -p -D -m 755 ${B}/${app_tarball} ${D}/${app_folder}
110         install -d -m 755 ${D}/opt/extracharts
111         install -p -D -m 755 ${S}/helm-charts/node-feature-discovery-*.tgz ${D}/opt/extracharts
112 }
113
114 FILES_${PN} = " \
115     /opt/extracharts \
116     ${app_folder} \
117 "
118
119 RDEPENDS_${PN} = " \
120     helm \
121     openstack-helm \
122     openstack-helm-infra \
123 "