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: 47191 Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com> Change-Id: If383233094d6539483c93016264d62da6dc4753f
This commit is contained in:
parent
d973a4b78a
commit
dcd76cd624
@ -23,11 +23,11 @@
|
|||||||
- starlingx/update
|
- starlingx/update
|
||||||
- starlingx/utilities
|
- starlingx/utilities
|
||||||
files:
|
files:
|
||||||
- python-k8sapp-sriov-fec-operator/*
|
- python3-k8sapp-sriov-fec-operator/*
|
||||||
vars:
|
vars:
|
||||||
tox_envlist: py39
|
tox_envlist: py39
|
||||||
python_version: 3.9
|
python_version: 3.9
|
||||||
tox_extra_args: -c python-k8sapp-sriov-fec-operator/k8sapp_sriov_fec_operator/tox.ini
|
tox_extra_args: -c python3-k8sapp-sriov-fec-operator/k8sapp_sriov_fec_operator/tox.ini
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: k8sapp-sriov-fec-operator-tox-pylint
|
name: k8sapp-sriov-fec-operator-tox-pylint
|
||||||
@ -41,7 +41,7 @@
|
|||||||
- starlingx/utilities
|
- starlingx/utilities
|
||||||
nodeset: ubuntu-bionic
|
nodeset: ubuntu-bionic
|
||||||
files:
|
files:
|
||||||
- python-k8sapp-sriov-fec-operator/*
|
- python3-k8sapp-sriov-fec-operator/*
|
||||||
vars:
|
vars:
|
||||||
tox_envlist: pylint
|
tox_envlist: pylint
|
||||||
tox_extra_args: -c python-k8sapp-sriov-fec-operator/k8sapp_sriov_fec_operator/tox.ini
|
tox_extra_args: -c python3-k8sapp-sriov-fec-operator/k8sapp_sriov_fec_operator/tox.ini
|
||||||
|
@ -1 +0,0 @@
|
|||||||
flock
|
|
@ -1 +0,0 @@
|
|||||||
stx-sriov-fec-operator-helm
|
|
@ -1,2 +0,0 @@
|
|||||||
stx-sriov-fec-operator-helm
|
|
||||||
python-k8sapp-sriov-fec-operator
|
|
@ -1,2 +0,0 @@
|
|||||||
stx-sriov-fec-operator-helm
|
|
||||||
python-k8sapp-sriov-fec-operator
|
|
@ -1 +0,0 @@
|
|||||||
sriov-fec-operator-images
|
|
@ -1,2 +1,2 @@
|
|||||||
python-k8sapp-sriov-fec-operator
|
python3-k8sapp-sriov-fec-operator
|
||||||
stx-sriov-fec-operator-helm
|
stx-sriov-fec-operator-helm
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
SRC_DIR="k8sapp_sriov_fec_operator"
|
|
||||||
|
|
||||||
TIS_PATCH_VER=PKG_GITREVCOUNT
|
|
@ -1,52 +0,0 @@
|
|||||||
%global app_name sriov-fec-operator
|
|
||||||
%global pypi_name k8sapp-sriov-fec-operator
|
|
||||||
%global sname k8sapp_sriov_fec_operator
|
|
||||||
|
|
||||||
Name: python-%{pypi_name}
|
|
||||||
Version: 1.0
|
|
||||||
Release: %{tis_patch_ver}%{?_tis_dist}
|
|
||||||
Summary: StarlingX sysinv extensions: Sriov fec operator
|
|
||||||
|
|
||||||
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: Sriov fec operator 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/*
|
|
@ -1 +0,0 @@
|
|||||||
plugins/sriov-fec-operator/*.whl
|
|
@ -1,2 +0,0 @@
|
|||||||
usr/lib/python3/dist-packages/k8sapp_sriov_fec_operator-1.0.0.egg-info/*
|
|
||||||
usr/lib/python3/dist-packages/k8sapp_sriov_fec_operator/*
|
|
@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
# export DH_VERBOSE = 1
|
|
||||||
|
|
||||||
export APP_NAME=sriov-fec-operator
|
|
||||||
export PBR_VERSION=1.0.0
|
|
||||||
export PYBUILD_NAME=k8sapp-sriov-fec-operator
|
|
||||||
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
|
|
@ -0,0 +1 @@
|
|||||||
|
plugins/*.whl
|
@ -0,0 +1 @@
|
|||||||
|
usr/lib/python3/dist-packages/k8sapp_*
|
33
python3-k8sapp-sriov-fec-operator/debian/deb_folder/rules
Normal file
33
python3-k8sapp-sriov-fec-operator/debian/deb_folder/rules
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
# export DH_VERBOSE = 1
|
||||||
|
|
||||||
|
export APP_NAME = sriov-fec-operator
|
||||||
|
export PYBUILD_NAME = k8sapp-sriov-fec-operator
|
||||||
|
|
||||||
|
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
|
@ -4,4 +4,6 @@ debver: 1.0-1
|
|||||||
src_path: k8sapp_sriov_fec_operator
|
src_path: k8sapp_sriov_fec_operator
|
||||||
revision:
|
revision:
|
||||||
dist: $STX_DIST
|
dist: $STX_DIST
|
||||||
PKG_GITREVCOUNT: true
|
GITREVCOUNT:
|
||||||
|
SRC_DIR: ${MY_REPO}/stx/app-sriov-fec-operator
|
||||||
|
BASE_SRCREV: 46a85804ca045e00ce0778d94f9bb4d3faa3f6cd
|
@ -38,5 +38,5 @@ systemconfig.helm_plugins.sriov_fec_operator =
|
|||||||
systemconfig.app_lifecycle =
|
systemconfig.app_lifecycle =
|
||||||
sriov-fec-operator = k8sapp_sriov_fec_operator.lifecycle.lifecycle_sriov_fec_operator:SriovFecOperatorAppLifecycleOperator
|
sriov-fec-operator = k8sapp_sriov_fec_operator.lifecycle.lifecycle_sriov_fec_operator:SriovFecOperatorAppLifecycleOperator
|
||||||
|
|
||||||
[wheel]
|
[bdist_wheel]
|
||||||
universal = 1
|
universal = 1
|
@ -1,90 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Copyright (c) 2022 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
IMAGE=$1
|
|
||||||
IMAGE_TAG=$2
|
|
||||||
export CONTAINER_TOOL=docker
|
|
||||||
export BASE_IMAGE="centos:7.9.2009"
|
|
||||||
|
|
||||||
echo "=============== build script ================"
|
|
||||||
echo image: "${IMAGE}"
|
|
||||||
echo image_tag: "${IMAGE_TAG}"
|
|
||||||
pwd
|
|
||||||
|
|
||||||
if [ -z "${IMAGE_TAG}" ]; then
|
|
||||||
echo "Image tag must be specified. build ${IMAGE} Aborting..." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_labeler_image() {
|
|
||||||
export SRIOV_FEC_LABELER_IMAGE=$1
|
|
||||||
|
|
||||||
sed -i "/FROM.*registry.*/c\FROM ${BASE_IMAGE}" \
|
|
||||||
Dockerfile.labeler
|
|
||||||
echo "labeler_image: ${SRIOV_FEC_LABELER_IMAGE}"
|
|
||||||
|
|
||||||
pwd
|
|
||||||
make image-sriov-fec-labeler
|
|
||||||
|
|
||||||
echo "Labeler image build done"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
build_daemon_image() {
|
|
||||||
export SRIOV_FEC_DAEMON_IMAGE=$1
|
|
||||||
|
|
||||||
sed -i "/FROM.*registry.*/c\FROM ${BASE_IMAGE}" \
|
|
||||||
Dockerfile.daemon
|
|
||||||
|
|
||||||
echo "daemon_image: ${SRIOV_FEC_DAEMON_IMAGE}"
|
|
||||||
|
|
||||||
pwd
|
|
||||||
make image-sriov-fec-daemon
|
|
||||||
|
|
||||||
echo "Daemon image build done"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
build_operator_image() {
|
|
||||||
|
|
||||||
export SRIOV_FEC_OPERATOR_IMAGE=$1
|
|
||||||
|
|
||||||
sed -i "/FROM.*registry.*/c\FROM ${BASE_IMAGE}" \
|
|
||||||
Dockerfile
|
|
||||||
|
|
||||||
echo "operator_image: ${SRIOV_FEC_OPERATOR_IMAGE}"
|
|
||||||
|
|
||||||
pwd
|
|
||||||
make image-sriov-fec-operator
|
|
||||||
|
|
||||||
echo "Operator image build done"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
case ${IMAGE} in
|
|
||||||
labeler)
|
|
||||||
echo "Build image: labeler"
|
|
||||||
build_labeler_image "${IMAGE_TAG}"
|
|
||||||
;;
|
|
||||||
daemon)
|
|
||||||
echo "build image: daemon"
|
|
||||||
build_daemon_image "${IMAGE_TAG}"
|
|
||||||
;;
|
|
||||||
operator)
|
|
||||||
echo "build image: Operator"
|
|
||||||
build_operator_image "${IMAGE_TAG}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported ARGS in ${image_build_file}: ${IMAGE}" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,9 +0,0 @@
|
|||||||
BUILDER=script
|
|
||||||
LABEL=sriov-fec-daemon
|
|
||||||
SOURCE_REPO=https://github.com/smart-edge-open/sriov-fec-operator.git
|
|
||||||
SOURCE_REF=7eec69b3b7151b1eaccaacd480004654af81784b
|
|
||||||
SOURCE_PATCHES="../files/0001-patch-for-docker-images.patch"
|
|
||||||
COMMAND=bash
|
|
||||||
SCRIPT=build-sriov-fec-operator-image.sh
|
|
||||||
ARGS=daemon
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
BUILDER=script
|
|
||||||
LABEL=sriov-fec-labeler
|
|
||||||
SOURCE_REPO=https://github.com/smart-edge-open/sriov-fec-operator.git
|
|
||||||
SOURCE_REF=7eec69b3b7151b1eaccaacd480004654af81784b
|
|
||||||
SOURCE_PATCHES="../files/0001-patch-for-docker-images.patch"
|
|
||||||
COMMAND=bash
|
|
||||||
SCRIPT=build-sriov-fec-operator-image.sh
|
|
||||||
ARGS=labeler
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
BUILDER=script
|
|
||||||
LABEL=sriov-fec-operator
|
|
||||||
SOURCE_REPO=https://github.com/smart-edge-open/sriov-fec-operator.git
|
|
||||||
SOURCE_REF=7eec69b3b7151b1eaccaacd480004654af81784b
|
|
||||||
SOURCE_PATCHES="../files/0001-patch-for-docker-images.patch"
|
|
||||||
COMMAND=bash
|
|
||||||
SCRIPT=build-sriov-fec-operator-image.sh
|
|
||||||
ARGS=operator
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
SRC_DIR="stx-sriov-fec-operator-helm"
|
|
||||||
|
|
||||||
TIS_PATCH_VER=PKG_GITREVCOUNT
|
|
||||||
|
|
||||||
#FluxCD version
|
|
||||||
SRIOV_FEC_OPERATOR_VERSION=0.1.0
|
|
||||||
|
|
||||||
COPY_LIST="${PKG_BASE}/${SRC_DIR}/helm-charts/* ${PKG_BASE}/${SRC_DIR}/files/*
|
|
||||||
${PKG_BASE}/${SRC_DIR}/fluxcd-manifests/*"
|
|
@ -1,94 +0,0 @@
|
|||||||
# Application tunables (maps to metadata)
|
|
||||||
%global app_name sriov-fec-operator
|
|
||||||
%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 Sriov Fec Operator Helm Charts
|
|
||||||
Name: stx-sriov-fec-operator-helm
|
|
||||||
Version: 1.0
|
|
||||||
Release: %{tis_patch_ver}%{?_tis_dist}
|
|
||||||
License: Apache-2.0
|
|
||||||
Group: base
|
|
||||||
Packager: Intel
|
|
||||||
URL: unknown
|
|
||||||
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
|
||||||
|
|
||||||
BuildArch: noarch
|
|
||||||
|
|
||||||
BuildRequires: helm
|
|
||||||
BuildRequires: python-k8sapp-sriov-fec-operator
|
|
||||||
BuildRequires: python-k8sapp-sriov-fec-operator-wheels
|
|
||||||
|
|
||||||
%description
|
|
||||||
StarlingX Sriov Fec Operator Helm Charts
|
|
||||||
|
|
||||||
%package fluxcd
|
|
||||||
Summary: StarlingX Sriov Fec Operator Application FluxCD Helm Charts
|
|
||||||
Group: base
|
|
||||||
License: Apache-2.0
|
|
||||||
|
|
||||||
%description fluxcd
|
|
||||||
StarlingX Sriov Fec Operator Application FluxCD Helm Charts
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -n %{name}-%{version}
|
|
||||||
|
|
||||||
%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 sriov-fec-operator
|
|
||||||
|
|
||||||
# switch back to source root
|
|
||||||
cd -
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
%define app_path %{_builddir}/%{app_tarball_fluxcd}
|
|
||||||
|
|
||||||
# Setup staging
|
|
||||||
cd %{_builddir}/%{name}-%{version}
|
|
||||||
mkdir -p %{app_staging}
|
|
||||||
cp files/metadata.yaml %{app_staging}
|
|
||||||
cp -R fluxcd-manifests %{app_staging}/
|
|
||||||
mkdir -p %{app_staging}/charts
|
|
||||||
cp helm-charts/*.tgz %{app_staging}/charts
|
|
||||||
|
|
||||||
# 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}
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{app_folder}/%{app_tarball_fluxcd}
|
|
@ -34,7 +34,7 @@ override_dh_auto_build:
|
|||||||
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml
|
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml
|
||||||
# Copy the plugins: installed in the buildroot
|
# Copy the plugins: installed in the buildroot
|
||||||
mkdir -p $(STAGING)/plugins
|
mkdir -p $(STAGING)/plugins
|
||||||
cp /plugins/$(APP_NAME)/*.whl $(STAGING)/plugins
|
cp /plugins/*.whl $(STAGING)/plugins
|
||||||
# Create the app package.
|
# Create the app package.
|
||||||
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
|
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
|
||||||
tar cfz $(APP_TARBALL) -C $(STAGING)/ .
|
tar cfz $(APP_TARBALL) -C $(STAGING)/ .
|
||||||
|
@ -4,4 +4,6 @@ debver: 1.0-1
|
|||||||
src_path: stx-sriov-fec-operator-helm
|
src_path: stx-sriov-fec-operator-helm
|
||||||
revision:
|
revision:
|
||||||
dist: $STX_DIST
|
dist: $STX_DIST
|
||||||
PKG_GITREVCOUNT: true
|
GITREVCOUNT:
|
||||||
|
SRC_DIR: ${MY_REPO}/stx/app-sriov-fec-operator
|
||||||
|
BASE_SRCREV: 46a85804ca045e00ce0778d94f9bb4d3faa3f6cd
|
||||||
|
Loading…
Reference in New Issue
Block a user