Files
snmp-armada-app/stx-snmp-helm/centos/stx-snmp-helm.spec
Thiago Brito 2e9b48c693 Use fluxcd app by default for snmp
This commit switches snmp to use the fluxcd app by default and also
preserves the armada app on the build for future tests.

TEST PLAN
PASS Build iso and verify apps
PASS Upload
PASS Apply
PASS Verify resources
PASS Remove
PASS Delete

Logs: https://paste.opendev.org/show/bZMwEQnmZqLTAomad46g/

Story: 2009138
Task: 45347

Signed-off-by: Thiago Brito <thiago.brito@windriver.com>
Change-Id: Ib25ce72bbb7f5aabf6f77bfa5737dc1d4f0f7a61
2022-05-12 20:06:00 -03:00

112 lines
2.7 KiB
RPMSpec

# Application tunables (maps to metadata)
%global app_name snmp
%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
%global toolkit_version 0.1.0
Summary: StarlingX SNMP FluxCD Helm Charts
Name: stx-snmp-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: helm-charts-snmp-0-1-0.tar.gz
BuildArch: noarch
BuildRequires: helm
BuildRequires: python-k8sapp-snmp
BuildRequires: python-k8sapp-snmp-wheels
%description
StarlingX SNMP Helm Charts
%package armada
Summary: StarlingX SNMP Armada Helm Charts
Group: base
License: Apache-2.0
%description armada
StarlingX SNMP Armada Helm Charts
%prep
%setup -n helm-charts-snmp-0-1-0-1.0.0
%build
cd helm-charts
make
# switch back to source root
cd -
# Create a chart tarball compliant with sysinv kube-app.py
%define app_staging %{_builddir}/staging
%define app_tarball_armada %{app_name}-armada-%{version}-%{tis_patch_ver}.tgz
%define app_tarball_fluxcd %{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
# Populate metadata
cd %{app_staging}
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
# calculate checksum of all files in app_staging
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
# package it up
tar -zcf %{_builddir}/%{app_tarball_armada} -C %{app_staging}/ .
# switch back to source root
cd -
# Prepare app_staging for fluxcd package
rm -f %{app_staging}/snmp_manifest.yaml
cp -R fluxcd-manifests %{app_staging}/
# calculate checksum of all files in app_staging
cd %{app_staging}
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
# package fluxcd app
tar -zcf %{_builddir}/%{app_tarball_fluxcd} -C %{app_staging}/ .
# switch back to source root
cd -
# Cleanup staging
rm -fr %{app_staging}
%install
install -d -m 755 %{buildroot}/%{app_folder}
install -p -D -m 755 %{_builddir}/%{app_tarball_armada} %{buildroot}/%{app_folder}
install -p -D -m 755 %{_builddir}/%{app_tarball_fluxcd} %{buildroot}/%{app_folder}
%files armada
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_armada}
%files
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_fluxcd}