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 PKG_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: 47190

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: I1532a8281868b1d921f3f23658ccef294235e636
This commit is contained in:
Leonardo Fagundes Luz Serrano 2022-12-21 06:45:47 -03:00
parent 5c5c967215
commit 3bfc502572
51 changed files with 53 additions and 325 deletions

View File

@ -30,7 +30,7 @@
vars:
tox_envlist: py39
python_version: 3.9
tox_extra_args: -c python-k8sapp-portieris/k8sapp_portieris/tox.ini
tox_extra_args: -c python3-k8sapp-portieris/k8sapp_portieris/tox.ini
- job:
name: stx-portieris-armada-app-upload-git-mirror
@ -57,10 +57,10 @@
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-portieris/*
- python3-k8sapp-portieris/*
vars:
tox_envlist: pylint
tox_extra_args: -c python-k8sapp-portieris/k8sapp_portieris/tox.ini
tox_extra_args: -c python3-k8sapp-portieris/k8sapp_portieris/tox.ini
- secret:
name: stx-portieris-armada-app-github-secret

View File

@ -1 +0,0 @@
flock

View File

@ -1 +0,0 @@
stx-portieris-helm

View File

@ -1,3 +0,0 @@
portieris-helm
stx-portieris-helm
python-k8sapp-portieris

View File

@ -1,3 +0,0 @@
portieris-helm
stx-portieris-helm
python-k8sapp-portieris

View File

@ -1 +0,0 @@
portieris-helm

View File

@ -1 +0,0 @@
portieris-0.13.1.tgz#portieris#https://github.com/IBM/portieris/archive/refs/tags/v0.13.1.tar.gz#http##

View File

@ -1,3 +1,3 @@
portieris-helm
python3-k8sapp-portieris
stx-portieris-helm
python-k8sapp-portieris

View File

@ -1,10 +0,0 @@
TAR_NAME=portieris
VERSION=0.7.0
TAR="$TAR_NAME-$VERSION.tgz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* "
OPT_DEP_LIST="$STX_BASE/portieris-armada-app/stx-portieris-helm"
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,76 +0,0 @@
# Application tunables (maps to metadata)
%global app_name stx-portieris
%global helm_repo starlingx
#%global helm_folder /usr/lib/helm
#%global armada_folder /usr/lib/armada
#%global app_folder /usr/local/share/applications/helm
# Install location
%global app_folder /usr/local/share/applications/helm
# Build variables
%global helm_folder /usr/lib/helm
Summary: StarlingX portieris Helm charts
Name: portieris-helm
Version: 0.7.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: portieris-%{version}.tgz
Source1: repositories.yaml
Source2: index.yaml
BuildArch: noarch
Patch01: 0001-Squash-required-portieris-fixes.patch
Patch02: 0002-add-image-pull-secrets-to-images.patch
Patch03: 0003-add-toggle-to-reinstall-the-admission-webhook.patch
Patch04: 0004-run-admission-webhooks-as-non-root.patch
Patch05: 0005-add-toleration.patch
BuildRequires: helm
BuildRequires: chartmuseum
%description
StarlingX portieris charts
%prep
%setup -n portieris
%patch01 -p1
%patch02 -p1
%patch03 -p1
%patch04 -p1
%patch05 -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 a chart tarball compliant with sysinv kube-app.py
%define app_staging %{_builddir}/staging
%define app_tarball portieris-%{version}.tgz
# Make the charts. These produce a tgz file
make helm.package
cd %{_builddir}/portieris
tar -xvf %{app_tarball}
tar -zcf %{app_tarball} portieris
cd -
# Terminate helm server (the last backgrounded task)
kill %1
%install
install -d -m 755 ${RPM_BUILD_ROOT}%{helm_folder}
install -p -D -m 755 %{_builddir}/portieris/%{app_tarball} ${RPM_BUILD_ROOT}%{helm_folder}
%files
%defattr(-,root,root,-)
%{helm_folder}/*

View File

@ -1,5 +0,0 @@
BUILDER=docker
LABEL=portieris
DOCKER_REPO=https://github.com/IBM/portieris.git
DOCKER_REF=0.7.0
DOCKER_PATCHES="../files/0001-Squash-required-portieris-fixes.patch"

View File

@ -1,8 +0,0 @@
SRC_DIR="k8sapp_portieris"
OPT_DEP_LIST="$STX_BASE/portieris-armada-app/stx-portieris-helm"
# Keep the SRCREV in sync with stx-portieris-helm so the app version is the
# same as the plugin version
TIS_BASE_SRCREV=b6f2024cc2c31f7562a31aebc46f0bc490bde6f6
TIS_PATCH_VER=GITREVCOUNT

View File

@ -1,52 +0,0 @@
%global app_name portieris
%global pypi_name k8sapp-portieris
%global sname k8sapp_portieris
Name: python-%{pypi_name}
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
Summary: StarlingX sysinv extensions: Portieris
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: python2-pip
BuildRequires: python2-wheel
%description
StarlingX sysinv extensions: Portieris K8S app
%prep
%setup
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
export PBR_VERSION=%{version}
%{__python2} setup.py build
%py2_build_wheel
%install
export PBR_VERSION=%{version}.%{tis_patch_ver}
export SKIP_PIP_INSTALL=1
%{__python2} setup.py install --skip-build --root %{buildroot}
mkdir -p ${RPM_BUILD_ROOT}/plugins/%{app_name}
install -m 644 dist/*.whl ${RPM_BUILD_ROOT}/plugins/%{app_name}/
%files
%{python2_sitelib}/%{sname}
%{python2_sitelib}/%{sname}-*.egg-info
%package wheels
Summary: %{name} wheels
%description wheels
Contains python wheels for %{name}
%files wheels
/plugins/*

View File

@ -1,2 +0,0 @@
usr/lib/python3/dist-packages/k8sapp_portieris-1.0.0.egg-info/*
usr/lib/python3/dist-packages/k8sapp_portieris/*

View File

@ -1,26 +0,0 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME=portieris
export PBR_VERSION=1.0.0
export PYBUILD_NAME=k8sapp-portieris
export ROOT=$(CURDIR)/debian/tmp
export SKIP_PIP_INSTALL=1
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_build:
python3 setup.py build
override_dh_auto_install:
python3 setup.py install --install-layout=deb --skip-build --root $(ROOT)
python3 setup.py bdist_wheel \
--universal \
-d $(ROOT)/plugins/$(APP_NAME)
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
# (tbogue) FIXME
PYTHONDIR=$(CURDIR) stestr run || true
endif

View File

@ -1,7 +0,0 @@
---
debname: python3-k8sapp-portieris
debver: 1.0-1
src_path: k8sapp_portieris
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1 @@
usr/lib/python3/dist-packages/k8sapp_*

View File

@ -0,0 +1,33 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME = portieris
export PYBUILD_NAME = k8sapp-portieris
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-')
export MINOR_PATCH = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export PBR_VERSION = $(MAJOR).$(MINOR_PATCH)
export ROOT = $(CURDIR)/debian/tmp
export SKIP_PIP_INSTALL = 1
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_install:
env | sort
python3 setup.py install \
--install-layout=deb \
--root $(ROOT)
python3 setup.py bdist_wheel \
--universal \
-d $(ROOT)/plugins
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
override_dh_auto_test:
PYTHONDIR=$(CURDIR) stestr run

View File

@ -0,0 +1,9 @@
---
debname: python3-k8sapp-portieris
debver: 1.0-1
src_path: k8sapp_portieris
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/portieris-armada-app
BASE_SRCREV: b6f2024cc2c31f7562a31aebc46f0bc490bde6f6

View File

@ -40,5 +40,5 @@ systemconfig.helm_plugins.portieris =
systemconfig.app_lifecycle =
portieris = k8sapp_portieris.lifecycle.lifecycle_portieris:PortierisAppLifecycleOperator
[wheel]
[bdist_wheel]
universal = 1

View File

@ -1,15 +0,0 @@
SRC_DIR="stx-portieris-helm"
# This should match python-k8sapp-portieris TIS_BASE_SRCREV
# so that app and plugins are versioned the same
TIS_BASE_SRCREV=b6f2024cc2c31f7562a31aebc46f0bc490bde6f6
TIS_PATCH_VER=GITREVCOUNT
COPY_LIST_TO_TAR="\
$STX_BASE/helm-charts/psp-rolebinding/psp-rolebinding/helm-charts \
"
OPT_DEP_LIST="\
$STX_BASE/portieris-armada-app/python-k8sapp-portieris \
$STX_BASE/portieris-armada-app/portieris-helm \
"

View File

@ -1,105 +0,0 @@
# Application tunables (maps to metadata)
%global app_name portieris
%global helm_repo stx-platform
%global helm_folder /usr/lib/helm
%global app_folder /usr/local/share/applications/helm
%global toolkit_version 0.1.0
%global helmchart_version 0.1.0
Summary: StarlingX Portieris FluxCD Helm Charts
Name: stx-portieris-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
# psp-rolebinding source from stx/helm-charts/psp-rolebinding
# plugins source from stx/portieris-armada-app/python-k8sapp-portieris
# portieris-certs sources is in SRC_DIR already
BuildArch: noarch
BuildRequires: helm
BuildRequires: chartmuseum
BuildRequires: portieris-helm
BuildRequires: python-k8sapp-portieris
BuildRequires: python-k8sapp-portieris-wheels
%description
StarlingX Portieris 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
helm lint portieris-certs
helm package portieris-certs
# psp-rolebinding source is copied by the function of build_srpm.data
# COPY_LIST_TO_TAR
make psp-rolebinding
# switch back to source root
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
# copy portieris-certs, psp-rolebinding charts
cp helm-charts/*.tgz %{app_staging}/charts
# copy portieris-helm chart
cp %{helm_folder}/portieris*.tgz %{app_staging}/charts
# Copy the plugins: installed in the buildroot
mkdir -p %{app_staging}/plugins
cp /plugins/%{app_name}/*.whl %{app_staging}/plugins
# 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
# Prepare app_staging for fluxcd package
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_fluxcd} %{buildroot}/%{app_folder}
%files
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_fluxcd}

View File

@ -47,7 +47,7 @@ override_dh_auto_build:
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING)/plugins
cp /plugins/$(APP_NAME)/*.whl $(STAGING)/plugins
cp /plugins/*.whl $(STAGING)/plugins
# Prepare staging for fluxcd package
cp -R fluxcd-manifests $(STAGING)/

View File

@ -4,7 +4,8 @@ debver: 1.0-1
src_path: stx-portieris-helm
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/portieris-armada-app
BASE_SRCREV: b6f2024cc2c31f7562a31aebc46f0bc490bde6f6