Standardize app configs

Fixed versioning and adjusted some build files
to bring them as close to a standard as possible.

- Removed centos files
- Added version tracking via GITREVCOUNT
- Fixed mismatch in plugin name, set to python3-k8sapp-<app>
- Standardized plugin debian files (rules, *.install)
- Plugin wheels saved to /plugin instead of /plugin/<app>

Test Plan:
PASS - Build-pkgs -a
PASS - Build-image
PASS - Install, bootstrap, unlock
PASS - app tarball contains wheel file
PASS - wheel versioning updated properly

Story: 2010542
Task: 47196

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: I4f791b91476bc044410e42309e2c2954f3529a99
This commit is contained in:
Leonardo Fagundes Luz Serrano 2022-12-21 06:42:11 -03:00
parent ad6ae97f8e
commit a1608b7a68
16 changed files with 5 additions and 179 deletions

View File

@ -1 +0,0 @@
flock

View File

@ -1,2 +0,0 @@
stx-metrics-server-helm

View File

@ -1,2 +0,0 @@
metrics-server-helm
stx-metrics-server-helm

View File

@ -1 +0,0 @@
stx-metrics-server-helm

View File

@ -1 +0,0 @@
sample-app

View File

@ -1 +0,0 @@
metrics-server-e67ee73cfc51e27eaf46b2af0ae8debd16c86d26.tgz#metrics-server#https://github.com/kubernetes-sigs/metrics-server/releases/download/metrics-server-helm-chart-3.8.2/metrics-server-3.8.2.tgz#http##

View File

@ -1,3 +1,2 @@
#stx-metrics-server-helm
stx-metrics-server-helm

View File

@ -1,2 +1,2 @@
stx-metrics-server-helm
metrics-server-helm
stx-metrics-server-helm

View File

@ -1,9 +0,0 @@
TAR_NAME=metrics-server
SHA=e67ee73cfc51e27eaf46b2af0ae8debd16c86d26
VERSION=1.0.0
TAR="$TAR_NAME-$SHA.tgz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* "
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,57 +0,0 @@
# Build variables
%global helm_folder /usr/lib/helm
%global sha e67ee73cfc51e27eaf46b2af0ae8debd16c86d26
Summary: Metrics-server helm chart
Name: metrics-server-helm
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: https://github.com/kubernetes-sigs/metrics-server#installation
Source0: metrics-server-%{sha}.tgz
Source1: repositories.yaml
Source2: index.yaml
Source3: Makefile
BuildArch: noarch
Patch01: 0001-Add-sample-app-to-metrics-server.patch
BuildRequires: helm
BuildRequires: chartmuseum
%description
StarlingX Metrics-Server Helm Charts
%prep
%setup -n metrics-server
%patch01 -p1
%build
# Host a server for the charts
chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" --storage-local-rootdir="." &
sleep 2
helm repo add local http://localhost:8879/charts
# Create the tgz file
cd ../
cp %{SOURCE3} ./
make metrics-server
# terminate helm server (the last backgrounded task)
kill %1
%install
cd ../
install -d -m 755 ${RPM_BUILD_ROOT}%{helm_folder}
install -p -D -m 755 *.tgz ${RPM_BUILD_ROOT}%{helm_folder}
%files
%defattr(-,root,root,-)
%{helm_folder}/*

View File

@ -10,3 +10,4 @@ dl_files:
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -1,4 +0,0 @@
BUILDER=docker
LABEL=stx-metrics-server-sample-app
DOCKER_CONTEXT=../docker/
DOCKER_FILE=../docker/Dockerfile.centos

View File

@ -1,11 +0,0 @@
FROM node:14.15.5-alpine3.13
WORKDIR /usr/src/app
COPY src/package*.json ./
RUN npm install
COPY src/ .
CMD [ "node", "sample-application.js" ]

View File

@ -1,12 +0,0 @@
SRC_DIR="stx-metrics-server-helm"
TIS_PATCH_VER=GITREVCOUNT
SRC_BASE_SRCREV=9fa1ccbdbae09c9726642bfbb5b20e27cd729f2c
COPY_LIST_TO_TAR="\
$STX_BASE/helm-charts/psp-rolebinding/psp-rolebinding/helm-charts \
"
OPT_DEP_LIST="\
$STX_BASE/metrics-server-armada-app/metrics-server-helm \
"

View File

@ -1,75 +0,0 @@
# Application tunables (maps to metadata)
%global app_name metrics-server
%global helm_repo stx-platform
%global helm_folder /usr/lib/helm
%global app_folder /usr/local/share/applications/helm
Summary: StarlingX Metrics Server FluxCD Helm Charts
Name: stx-metrics-server-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: metrics-server-helm
%description
StarlingX Metrics Server FluxCD Helm Charts
%prep
%setup
%build
# Host a server for the charts
chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" --storage-local-rootdir="." &
sleep 2
helm repo add local http://localhost:8879/charts
# Make the charts. These produce a tgz file
cd helm-charts
make
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_fluxcd %{app_name}-%{version}-%{tis_patch_ver}.tgz
# Setup staging
mkdir -p %{app_staging}
cp files/metadata.yaml %{app_staging}
mkdir -p %{app_staging}/charts
cp helm-charts/*.tgz %{app_staging}/charts
cp %{helm_folder}/metrics*.tgz %{app_staging}/charts
# 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
#package fluxcd
cp -Rv fluxcd-manifests %{app_staging}/
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf %{_builddir}/%{app_tarball_fluxcd} -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_fluxcd} %{buildroot}/%{app_folder}
%files
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_fluxcd}

View File

@ -6,4 +6,6 @@ src_files:
- ${MY_REPO}/stx/helm-charts/psp-rolebinding/psp-rolebinding/helm-charts
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/metrics-server-armada-app
BASE_SRCREV: 9fa1ccbdbae09c9726642bfbb5b20e27cd729f2c