Revert "Standardize app configs"

This reverts commit 12c005958c.

The commit removed centos prematurely,
causing container stx-platformclients to fail to build

Closes-Bug: 2004506
Change-Id: Ie7fb0014d3bdbef82b2289548214e81b068526f9
This commit is contained in:
Leonardo Fagundes Luz Serrano 2023-02-01 18:02:43 -03:00
parent 12c005958c
commit 71583562ec
54 changed files with 320 additions and 68 deletions

View File

@ -34,10 +34,10 @@
- starlingx/update
- starlingx/utilities
files:
- python3-k8sapp-oidc/*
- python-k8sapp-oidc/*
vars:
tox_envlist: py27
tox_extra_args: -c python3-k8sapp-oidc/k8sapp_oidc/tox.ini
tox_extra_args: -c python-k8sapp-oidc/k8sapp_oidc/tox.ini
- job:
name: k8sapp-oidc-tox-py39
@ -51,11 +51,11 @@
- starlingx/update
- starlingx/utilities
files:
- python3-k8sapp-oidc/*
- python-k8sapp-oidc/*
vars:
tox_envlist: py39
python_version: 3.9
tox_extra_args: -c python3-k8sapp-oidc/k8sapp_oidc/tox.ini
tox_extra_args: -c python-k8sapp-oidc/k8sapp_oidc/tox.ini
- job:
@ -65,10 +65,10 @@
Run flake8 test for k8sapp_oidc
nodeset: ubuntu-focal
files:
- python3-k8sapp-oidc/*
- python-k8sapp-oidc/*
vars:
tox_envlist: flake8
tox_extra_args: -c python3-k8sapp-oidc/k8sapp_oidc/tox.ini
tox_extra_args: -c python-k8sapp-oidc/k8sapp_oidc/tox.ini
- job:
name: k8sapp-oidc-tox-pylint
@ -82,10 +82,10 @@
- starlingx/update
- starlingx/utilities
files:
- python3-k8sapp-oidc/*
- python-k8sapp-oidc/*
vars:
tox_envlist: pylint
tox_extra_args: -c python3-k8sapp-oidc/k8sapp_oidc/tox.ini
tox_extra_args: -c python-k8sapp-oidc/k8sapp_oidc/tox.ini
- job:
name: k8sapp-oidc-tox-bandit
@ -94,10 +94,10 @@
Run bandit test for k8sapp_oidc
nodeset: ubuntu-focal
files:
- python3-k8sapp-oidc/*
- python-k8sapp-oidc/*
vars:
tox_envlist: bandit
tox_extra_args: -c python3-k8sapp-oidc/k8sapp_oidc/tox.ini
tox_extra_args: -c python-k8sapp-oidc/k8sapp_oidc/tox.ini
- job:
name: stx-oidc-auth-armada-app-upload-git-mirror

1
centos_build_layer.cfg Normal file
View File

@ -0,0 +1 @@
flock

2
centos_iso_image.inc Normal file
View File

@ -0,0 +1,2 @@
stx-oidc-auth-helm
oidcauthtools

3
centos_pkg_dirs Normal file
View File

@ -0,0 +1,3 @@
stx-oidc-auth-helm
oidc-auth-tools
python-k8sapp-oidc

View File

@ -0,0 +1,2 @@
stx-oidc-auth-helm
python-k8sapp-oidc

1
centos_stable_wheels.inc Normal file
View File

@ -0,0 +1 @@
oidcauthtools-wheels

1
centos_tarball-dl.lst Normal file
View File

@ -0,0 +1 @@
dex-0.8.2.tgz#dex#https://github.com/dexidp/helm-charts/releases/download/dex-0.8.2/dex-0.8.2.tgz#https##

View File

@ -1,3 +1,3 @@
oidc-auth-tools
python3-k8sapp-oidc
stx-oidc-auth-helm
oidc-auth-tools
python-k8sapp-oidc

View File

@ -0,0 +1,2 @@
SRC_DIR="oidcauthtools"
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -0,0 +1,74 @@
%global pypi_name oidcauthtools
Summary: OIDC authentication tool package
Name: %{pypi_name}
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
BuildArch: noarch
Source: %name-%version.tar.gz
BuildRequires: python-pbr >= 2.0.0
BuildRequires: python-setuptools
BuildRequires: python2-wheel
Requires: python2-mechanize
Requires: python2-html5lib
Requires: python2-webencodings
Requires: python-pbr >= 2.0.0
%description
This package contains OIDC authentication tools to obtain token
from DEX and setup kubernetes credential for a user.
%define local_bindir /usr/bin/
%define pythonroot /usr/lib/python2.7/site-packages
%prep
%setup
# Remove bundled egg-info
rm -rf *.egg-info
%build
export PBR_VERSION=%{version}
%{__python2} setup.py build
%py2_build_wheel
%install
export PBR_VERSION=%{version}
%{__python} setup.py install --root=$RPM_BUILD_ROOT \
--install-lib=%{pythonroot} \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
mkdir -p $RPM_BUILD_ROOT/wheels
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
%global _buildsubdir %{_builddir}/%{name}-%{version}
install -d 755 %{buildroot}%{local_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%license LICENSE
%defattr(-,root,root,-)
/usr/bin/*
%{python2_sitelib}/oidcauthtools
%{python2_sitelib}/*.egg-info
%package wheels
Summary: %{name} wheels
%description wheels
Contains python wheels for %{name}
%files wheels
/wheels/*

View File

@ -1,2 +1,3 @@
usr/bin/oidc-auth
usr/lib/python3/dist-packages/oidcauthtools*/*
usr/lib/python3/dist-packages/oidcauthtools-1.0.0.egg-info/*
usr/lib/python3/dist-packages/oidcauthtools/*

View File

@ -1,11 +1,8 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
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 PBR_VERSION=1.0.0
export ROOT=$(CURDIR)/debian/tmp
%:
dh $@ --with=python3 --buildsystem=pybuild

View File

@ -31,5 +31,5 @@ console_scripts =
cover-erase = true
verbosity = 2
[bdist_wheel]
[wheel]
universal = 1

View File

@ -0,0 +1,6 @@
SRC_DIR="k8sapp_oidc"
# Keep the SRCREV in sync with stx-oidc-auth-helm so the app version is the same
# as the plugin version
TIS_BASE_SRCREV=860834c14ba54eb047ef02bde7a1f2407ce700ad
TIS_PATCH_VER=GITREVCOUNT

View File

@ -0,0 +1,52 @@
%global app_name oidc-auth-apps
%global pypi_name k8sapp-oidc
%global sname k8sapp_oidc
Name: python-%{pypi_name}
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
Summary: StarlingX sysinv extensions: OIDC authorization K8S app
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: OIDC authorization 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

@ -0,0 +1 @@
plugins/oidc-auth-apps/*.whl

View File

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

View File

@ -0,0 +1,22 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME=oidc-auth-apps
export PBR_VERSION=1.0.0
export PYBUILD_NAME=k8sapp_oidc
export ROOT=debian/tmp
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_install:
python3 setup.py install --install-layout=deb --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

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

View File

@ -37,5 +37,5 @@ systemconfig.helm_plugins.oidc_auth_apps =
002_oidc-client = k8sapp_oidc.helm.oidc_client:OidcClientHelm
003_secret-observer = k8sapp_oidc.helm.secret_observer:SecretObserverHelm
[bdist_wheel]
[wheel]
universal = 1

View File

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

View File

@ -1,33 +0,0 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME = oidc-auth-apps
export PYBUILD_NAME = k8sapp_oidc
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

@ -1,9 +0,0 @@
---
debname: python3-k8sapp-oidc
debver: 1.0-1
src_path: k8sapp_oidc
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/oidc-auth-armada-app
BASE_SRCREV: 860834c14ba54eb047ef02bde7a1f2407ce700ad

View File

@ -0,0 +1,13 @@
SRC_DIR="stx-oidc-auth-helm"
# Keep the SRCREV in sync with python-k8sapp-oidc so the app version is the same
# as the plugin version
TIS_BASE_SRCREV=860834c14ba54eb047ef02bde7a1f2407ce700ad
TIS_PATCH_VER=GITREVCOUNT
COPY_LIST="$PKG_BASE/$SRC_DIR/files/*"
COPY_LIST_TO_TAR="\
$STX_BASE/downloads/dex-0.8.2.tgz
$STX_BASE/helm-charts/secret-observer/secret-observer/helm-charts \
"

View File

@ -0,0 +1,111 @@
# Application tunables (maps to metadata)
%global app_name oidc-auth-apps
%global helm_repo stx-platform
# Install location
%global app_folder /usr/local/share/applications/helm
# backup location of dex overrides
%global override_backup /opt/oidc-auth-apps
# Build variables
%global helm_folder /usr/lib/helm
# the dex chart tar name
%global dex_tar_name dex-0.8.2.tgz
Summary: The StarlingX K8S application for OIDC authorization
Name: stx-oidc-auth-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
# a patch for secret observer
Patch01: 0001-move-metadata-release-for-helmv3.patch
# secret-observer source from stx/helm-charts/secret-observer
# plugin source from stx/oidc-auth-armada-app/python-k8sapp-oidc
# dex-helm source from stx/downloads/dex-0.8.2.tgz
BuildArch: noarch
BuildRequires: helm
BuildRequires: python-k8sapp-oidc
BuildRequires: python-k8sapp-oidc-wheels
%description
The StarlingX K8S application for OIDC authorization
%prep
%setup
%patch01 -p1
%build
# This chart does not require chartmuseum server since
# it has no dependency on local or stable repos.
# Make the charts. These produce a tgz file
cd helm-charts
make oidc-client
make secret-observer
# switch back to source root
cd -
# patch the dex chart
tar xf %{dex_tar_name}
rm %{dex_tar_name}
patch -p1 < files/0001-Create-new-config-value-extraStaticClients.patch
find dex -type f -print0 | xargs -0 tar zcf %{dex_tar_name}
rm -r dex
# 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
%define app_path %{_builddir}/%{app_tarball}
# 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 dex*.tgz %{app_staging}/charts
cp -R fluxcd-manifests %{app_staging}/
# Copy the plugins: installed in the buildroot
mkdir -p %{app_staging}/plugins
cp /plugins/%{app_name}/*.whl %{app_staging}/plugins
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
# calculate checksum of all files in app_staging
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
# package the app
tar -zcf %app_path -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 %app_path %{buildroot}/%{app_folder}
install -d -m 750 %{buildroot}/%{override_backup}
%files
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball}
%dir %attr(750, postgres, postgres) %{override_backup}

View File

@ -45,7 +45,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/*.whl $(STAGING)/plugins
cp /plugins/$(APP_NAME)/*.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

@ -11,6 +11,4 @@ dl_files:
md5sum: bfbe56a46cf23c68d27c6a018a565d95
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/oidc-auth-armada-app
BASE_SRCREV: 860834c14ba54eb047ef02bde7a1f2407ce700ad
PKG_GITREVCOUNT: true