ptp-notification-armada-app/stx-ptp-notification-helm/centos/stx-ptp-notification-helm.spec
Cole Walker eea4578dd1 Added armada manifest and required build files
This commit builds the armada manifest and packages the base helm charts
and sysinv integration code into the final rpm. The output rpm,
stx-ptp-notification-helm*.rpm can be deployed on a running system.

Removes unused files in ptp-notification-helm. All required charts are
now located under stx-ptp-notification-helm.

Story: 2008529
Task: 41724

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: I49e970b7d21e4078aea3d185fbe98910f3d59ce6
2021-02-03 17:41:00 -05:00

88 lines
2.2 KiB
RPMSpec

# Application tunables (maps to metadata)
%global app_name ptp-notification
%global helm_repo stx-platform
%global armada_folder /usr/lib/armada
# Install location
%global app_folder /usr/local/share/applications/helm
# Build variables
%global helm_folder /usr/lib/helm
Summary: StarlingX PTP Notification Armada Helm Charts
Name: stx-ptp-notification-helm
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: helm
BuildRequires: chartmuseum
BuildRequires: python-k8sapp-ptp-notification
BuildRequires: python-k8sapp-ptp-notification-wheels
%description
StarlingX PTP Notification Helm Charts
%prep
%setup -n %{name}-%{version}
%build
chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" --storage-local-rootdir="." &
sleep 2
helm repo add local http://localhost:8879/charts
cd helm-charts
make ptp-notification
make psp-rolebinding
cd -
# Terminate helm server (the last backgrounded task)
kill %1
# Create a chart tarball compliant with sysinv kube-app.py
%define app_staging %{_builddir}/staging
%define app_tarball %{app_name}-%{version}-%{tis_patch_ver}.tgz
# Setup staging
mkdir -p %{app_staging}
cp files/metadata.yaml %{app_staging}
cp manifests/*.yaml %{app_staging}
mkdir -p %{app_staging}/charts
cp helm-charts/*.tgz %{app_staging}/charts
#cp %{helm_folder}/*.tgz %{app_staging}/charts
cd %{app_staging}
# Populate metadata
sed -i 's/@APP_NAME@/%{app_name}/g' %{app_staging}/metadata.yaml
sed -i 's/@APP_VERSION@/%{version}-%{tis_patch_ver}/g' %{app_staging}/metadata.yaml
sed -i 's/@HELM_REPO@/%{helm_repo}/g' %{app_staging}/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p %{app_staging}/plugins
cp /plugins/%{app_name}/*.whl %{app_staging}/plugins
# package it up
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf %{_builddir}/%{app_tarball} -C %{app_staging}/ .
# Cleanup staging
rm -fr %{app_staging}
%install
install -d -m 755 %{buildroot}/%{app_folder}
install -p -D -m 755 %{_builddir}/%{app_tarball} %{buildroot}/%{app_folder}
%files
%defattr(-,root,root,-)
%{app_folder}/*