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: 47199

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: Ia945e29b1b02195234119b75f6ce155d58e92bca
This commit is contained in:
Leonardo Fagundes Luz Serrano 2022-12-20 15:57:27 -03:00
parent a181f1cd00
commit 87ea1bbd41
51 changed files with 60 additions and 339 deletions

View File

@ -26,11 +26,11 @@
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-istio/*
- python3-k8sapp-istio/*
vars:
tox_envlist: py39
python_version: 3.9
tox_extra_args: -c python-k8sapp-istio/k8sapp_istio/tox.ini
tox_extra_args: -c python3-k8sapp-istio/k8sapp_istio/tox.ini
- job:
name: stx-app-istio-upload-git-mirror
parent: upload-git-mirror
@ -56,10 +56,10 @@
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-istio/*
- python3-k8sapp-istio/*
vars:
tox_envlist: pylint
tox_extra_args: -c python-k8sapp-istio/k8sapp_istio/tox.ini
tox_extra_args: -c python3-k8sapp-istio/k8sapp_istio/tox.ini
- secret:
name: stx-app-istio-github-secret

View File

@ -1 +0,0 @@
flock

View File

@ -1 +0,0 @@
stx-istio-helm-fluxcd

View File

@ -1,4 +0,0 @@
istio-helm
kiali-helm
stx-istio-helm
python-k8sapp-istio

View File

@ -1,2 +0,0 @@
stx-istio-helm
python-k8sapp-istio

View File

@ -1,2 +0,0 @@
helm-charts-istio-1.13.3.tar.gz#helm-charts-istio#https://github.com/istio/istio/archive/refs/tags/1.13.3.tar.gz#http##
helm-charts-kiali-1.45.0.tar.gz#helm-charts-kiali#https://github.com/kiali/helm-charts/archive/refs/tags/v1.45.0.tar.gz#http##

View File

@ -1,4 +1,4 @@
istio-helm
kiali-helm
python-k8sapp-istio
python3-k8sapp-istio
stx-istio-helm

View File

@ -1,9 +0,0 @@
TAR_NAME=helm-charts-istio
VERSION=1.13.3
TAR="$TAR_NAME-$VERSION.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* "
OPT_DEP_LIST="$STX_BASE/app-istio/stx-istio-helm"
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,56 +0,0 @@
# Build variables
%global helm_folder /usr/lib/helm
Summary: Istio helm charts
Name: istio-helm
Version: 1.13.3
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: helm-charts-istio-%{version}.tar.gz
Source1: repositories.yaml
Source2: index.yaml
Source3: Makefile
BuildArch: noarch
BuildRequires: helm
BuildRequires: chartmuseum
%description
StarlingX Istio Helm Charts
%prep
%setup -n helm-charts-istio
#%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 files
cp %{SOURCE3} manifests/charts
cd manifests/charts
find . -type f -name "Chart.yaml" -exec sed -i -e '/version/ s/:.*$/: %{version}/' {} \;
make istio-operator
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 manifests/charts/*.tgz ${RPM_BUILD_ROOT}%{helm_folder}
%files
%defattr(-,root,root,-)
%{helm_folder}/*

View File

@ -1,7 +0,0 @@
TAR_NAME=helm-charts-kiali
VERSION=1.45.0
TAR="$TAR_NAME-$VERSION.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* "
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,39 +0,0 @@
# Build variables
%global helm_folder /usr/lib/helm
Summary: Kiali helm charts
Name: kiali-helm
Version: 1.45.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: helm-charts-kiali-%{version}.tar.gz
Source1: repositories.yaml
Source2: index.yaml
Source3: Makefile
BuildArch: noarch
BuildRequires: helm
BuildRequires: gettext
%description
StarlingX Kiali Helm Charts
%prep
%setup -n helm-charts-kiali
%build
make build-helm-charts
%install
install -d -m 755 ${RPM_BUILD_ROOT}%{helm_folder}
install -p -D -m 755 _output/charts/*.tgz ${RPM_BUILD_ROOT}%{helm_folder}
%files
%defattr(-,root,root,-)
%{helm_folder}/*

View File

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

View File

@ -1,52 +0,0 @@
%global app_name istio
%global pypi_name k8sapp-istio
%global sname k8sapp_istio
Name: python-%{pypi_name}
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
Summary: StarlingX sysinv extensions: Istio
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: Istio 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_istio-1.0.0.egg-info/*
usr/lib/python3/dist-packages/k8sapp_istio/*

View File

@ -1,26 +0,0 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME=istio
export PBR_VERSION=1.0.0
export PYBUILD_NAME=k8sapp-istio
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-istio
debver: 1.0-1
src_path: k8sapp_istio
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -2,4 +2,4 @@ python3-k8sapp-istio (1.0-1) unstable; urgency=medium
* Initial release.
-- Teresa Ho <teresa.ho@windriver.com> Thu, 31 Mar 2022 08:40:22 +000
-- Teresa Ho <teresa.ho@windriver.com> Thu, 31 Mar 2022 08:40:22 +0000

View File

@ -0,0 +1 @@
plugins/*.whl

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 = istio
export PYBUILD_NAME = k8sapp-istio
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-')
export MINOR = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export PBR_VERSION = $(MAJOR).$(MINOR)
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-istio
debver: 1.0-1
src_path: k8sapp_istio
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/app-istio
BASE_SRCREV: 28fb552abeb93fce220528fa4e29027f8ff394f6

View File

@ -39,5 +39,5 @@ systemconfig.helm_plugins.istio =
systemconfig.app_lifecycle =
istio = k8sapp_istio.lifecycle.lifecycle_istio:IstioAppLifecycleOperator
[wheel]
[bdist_wheel]
universal = 1

View File

@ -1,5 +1,5 @@
[tox]
envlist = flake8,py27,py36,py39,pylint,bandit
envlist = flake8,py27,py39,pylint,bandit
minversion = 1.6
# skipsdist = True
#,pip-missing-reqs
@ -23,7 +23,7 @@ allowlist_externals = bash
install_command = pip install \
-v -v -v --use-deprecated legacy-resolver \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/yoga/upper-constraints.txt} \
{opts} {packages}
# Note the hash seed is set to 0 until can be tested with a
@ -83,13 +83,6 @@ commands =
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pep8]
# testenv:flake8 clone
basepython = {[testenv:flake8]basepython}

View File

@ -1,20 +0,0 @@
SRC_DIR="stx-istio-helm"
# Keep the SRCREV in sync with python-k8sapp-istio so the app version is
# the same as the plugin version
TIS_BASE_SRCREV=28fb552abeb93fce220528fa4e29027f8ff394f6
TIS_PATCH_VER=GITREVCOUNT
TAR_NAME=helm-charts-istio
# FluxCD version
ISTIO_VERSION=1.13.3
FLUXCD_TAR="$TAR_NAME-$ISTIO_VERSION.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$FLUXCD_TAR $PKG_BASE/$SRC_DIR/files/* $PKG_BASE/$SRC_DIR/fluxcd-manifests/*"
OPT_DEP_LIST="\
$STX_BASE/app-istio/python-k8sapp-istio \
$STX_BASE/app-istio/istio-helm \
$STX_BASE/app-istio/kiali-helm \
"

View File

@ -1,81 +0,0 @@
# Application tunables (maps to metadata)
%global app_name istio
%global helm_repo stx-platform
# Install location
%global app_folder /usr/local/share/applications/helm
# Build variables
%global helm_folder /usr/lib/helm
Summary: StarlingX Istio Helm Charts
Name: stx-istio-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-istio-%{version}.tar.gz
BuildArch: noarch
BuildRequires: helm
BuildRequires: chartmuseum
BuildRequires: istio-helm
BuildRequires: kiali-helm
BuildRequires: python-k8sapp-istio
BuildRequires: python-k8sapp-istio-wheels
Requires: kiali-helm
%description
StarlingX Istio Helm Charts
%package fluxcd
Summary: StarlingX Istio Application FluxCD Helm Charts
Group: base
License: Apache-2.0
%description fluxcd
StarlingX Istio Application FluxCD Helm Charts
%prep
%setup -n helm-charts-istio-%{version}
%build
# Create a chart tarball compliant with sysinv kube-app.py
%define app_staging %{_builddir}/staging
%define app_tarball_fluxcd %{app_name}-fluxcd-%{version}-%{tis_patch_ver}.tgz
# Setup staging
cd %{_builddir}/helm-charts-istio-%{version}
mkdir -p %{app_staging}
cp files/metadata.yaml %{app_staging}
cp -R fluxcd-manifests %{app_staging}/
mkdir -p %{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
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 fluxcd
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_fluxcd}

View File

@ -6,10 +6,10 @@ export APP_FOLDER = $(ROOT)/usr/local/share/applications/helm
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 2 -d '.')
export MINOR = $(shell echo $(DEB_VERSION) | cut -f 2 -d '.')
export APP_NAME = istio
export APP_VERSION = $(MAJOR).$(MINOR_PATCH)
export APP_VERSION = $(MAJOR).$(MINOR)
export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING = staging
@ -30,7 +30,7 @@ override_dh_auto_build:
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING)/plugins
cp /plugins/$(APP_NAME)/*.whl $(STAGING)/plugins
cp /plugins/*.whl $(STAGING)/plugins
# Create the app package.
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar cfz $(APP_TARBALL) -C $(STAGING)/ .

View File

@ -4,4 +4,6 @@ debver: 1.0-1
src_path: stx-istio-helm
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/app-istio
BASE_SRCREV: 28fb552abeb93fce220528fa4e29027f8ff394f6