Add Debian packaging for cert-manager app

Create Debian packages for cert-manager-helm,
python-k8sapp-cert-manager and stx-cert-manager-helm.

Story: 2009101
Task: 43785

Signed-off-by: Tracey Bogue <tracey.bogue@windriver.com>
Change-Id: Ibd3ffe1acc46d078960f2b8e534c2a4bb6b1fe16
This commit is contained in:
Tracey Bogue
2021-10-27 08:48:12 -05:00
parent 87152b9900
commit ff07eeb51c
25 changed files with 409 additions and 0 deletions

View File

@@ -0,0 +1 @@
usr/lib/helm/*

View File

@@ -0,0 +1,5 @@
cert-manager-helm (1.0-1) unstable; urgency=medium
* Initial release.
-- Tracey Bogue <tracey.bogue@windriver.com> Mon, 25 Oct 2021 15:14:42 +0000

View File

@@ -0,0 +1,18 @@
Source: cert-manager-helm
Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
chartmuseum,
helm,
procps
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: cert-manager-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Cert Manager Helm Charts
This package contains certificate manager helm charts for the certificate
manager application.

View File

@@ -0,0 +1,41 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cert-manager-helm
Source: https://opendev.org/starlingx/cert-manager-armada-app/
Files: *
Copyright: (c) 2013-2021 Wind River Systems, Inc
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2021 Wind River Systems, Inc
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.

View File

@@ -0,0 +1,40 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export ROOT = debian/tmp
export CHART_FOLDER = $(ROOT)/usr/lib/helm
%:
dh $@
override_dh_auto_build:
# Move the extracted helm chart files to the top level build directory.
# Remove the helm-charts-certmanager Makefile first so it doesn't overwrite
# our Makefile.
rm helm-charts-certmanager/Makefile
mv helm-charts-certmanager/* .
# Apply the daemonset tolerations patch.
patch -p1 < 0001-Patch-for-acmesolver.patch
# Host a server for the helm charts.
chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" --storage-local-rootdir="." &
sleep 2
helm repo add local http://localhost:8879/charts
# Copy CRD yaml files to templates.
cp deploy/crds/*.yaml deploy/charts/cert-manager/templates/
# Set up chart build files.
cp Makefile deploy/charts
# In Cert-manager release-0.15, 'helm lint' fails
# on templates/BUILD.bazel (with invalid file extension).
# Remove the problem file.
rm deploy/charts/cert-manager/templates/BUILD.bazel
# Create the TGZ file.
cd deploy/charts && make cert-manager
# Terminate the helm chart server.
pkill chartmuseum
override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(CHART_FOLDER)
install -p -D -m 755 deploy/charts/*.tgz $(CHART_FOLDER)
override_dh_auto_test:

View File

@@ -0,0 +1 @@
3.0 (quilt)

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -x
PKG_BUILD_NAME=$1
PKG_BUILD_ROOT=$(realpath `pwd`/${PKG_BUILD_NAME})
PKG_DIR="cert-manager-helm"
STX_BASE=$(realpath ${MY_REPO}/stx)
SRC=$(realpath ${STX_BASE}/cert-manager-armada-app/${PKG_DIR})
mkdir -p ${PKG_BUILD_ROOT}
pushd ${PKG_BUILD_ROOT}
# Local mirror workaround until CGCS_BASE mirror is supported.
STX_MIRROR=$(realpath "/import/mirrors/starlingx")
# Download certmanager helm source package.
CERT_MGR_PKG="helm-charts-certmanager-1d6ecc9cf8d841782acb5f3d3c28467c24c5fd18.tar.gz"
CERT_MGR_SRC_PATH=$(realpath ${STX_MIRROR}/downloads/${CERT_MGR_PKG})
cp ${CERT_MGR_SRC_PATH} ${PKG_BUILD_ROOT}
# Extract the certmanager tar file.
tar xfz ${CERT_MGR_PKG}
# Copy source files to the build directory.
cp -pr ${SRC}/files/* ${PKG_BUILD_ROOT}

View File

@@ -0,0 +1,7 @@
---
debname: cert-manager-helm
debver: 1.0-1
dl_hook: dl_hook
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

3
debian_pkg_dirs Normal file
View File

@@ -0,0 +1,3 @@
cert-manager-helm
python-k8sapp-cert-manager
stx-cert-manager-helm

View File

@@ -0,0 +1,5 @@
python3-k8sapp-cert-manager (1.0-1) unstable; urgency=medium
* Initial release.
-- Tracey Bogue <tracey.bogue@windriver.com> Mon, 25 Oct 2021 14:50:42 +0000

View File

@@ -0,0 +1,28 @@
Source: python3-k8sapp-cert-manager
Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
dh-python,
python3-all,
python3-pbr,
python3-setuptools,
python3-wheel
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: python3-k8sapp-cert-manager
Section: libs
Architecture: any
Depends: ${misc:Depends}, ${python3:Depends}
Description: StarlingX Sysinv Certificate Manager Extensions
This package contains sysinv plugins for the certificate manager
K8S app.
Package: python3-k8sapp-cert-manager-wheels
Section: libs
Architecture: any
Depends: ${misc:Depends}, ${python3:Depends}, python3-wheel
Description: StarlingX Sysinv Certificate Manager Extension Wheels
This package contains python wheels for the certificate manager
K8S app plugins.

View File

@@ -0,0 +1,41 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: python3-k8sapp-cert-manager
Source: https://opendev.org/starlingx/cert-manager-armada-app/
Files: *
Copyright: (c) 2013-2021 Wind River Systems, Inc
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2021 Wind River Systems, Inc
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.

View File

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

View File

@@ -0,0 +1,5 @@
usr/lib/python3/dist-packages/k8sapp_cert_manager-1.0.0.egg-info/*
usr/lib/python3/dist-packages/k8sapp_cert_manager/*.py
usr/lib/python3/dist-packages/k8sapp_cert_manager/common/*.py
usr/lib/python3/dist-packages/k8sapp_cert_manager/helm/*.py
usr/lib/python3/dist-packages/k8sapp_cert_manager/tests/*.py

View File

@@ -0,0 +1,29 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME=cert-manager
export PBR_VERSION=1.0.0
export PYBUILD_NAME=k8sapp_cert_manager
export ROOT=debian/tmp
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_install:
python3 setup.py install --install-layout=deb --root $(ROOT)
rm -rf $(ROOT)/usr/lib/python3/dist-packages/k8sapp_cert_manager/__pycache__
rm -rf $(ROOT)/usr/lib/python3/dist-packages/k8sapp_cert_manager/common/__pycache__
rm -rf $(ROOT)/usr/lib/python3/dist-packages/k8sapp_cert_manager/helm/__pycache__
rm -rf $(ROOT)/usr/lib/python3/dist-packages/k8sapp_cert_manager/tests/__pycache__
python3 setup.py bdist_wheel \
--universal \
-d $(ROOT)/plugins/$(APP_NAME)
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
# (tbogue) FIXME
PYTHONDIR=$(CURDIR) stestr run || true
endif

View File

@@ -0,0 +1 @@
3.0 (quilt)

View File

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

View File

@@ -0,0 +1,5 @@
stx-cert-manager-helm (1.0-1) unstable; urgency=medium
* Initial release.
-- Tracey Bogue <tracey.bogue@windriver.com> Tue, 26 Oct 2021 14:00:42 +0000

View File

@@ -0,0 +1,21 @@
Source: stx-cert-manager-helm
Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
cert-manager-helm,
chartmuseum,
helm,
procps,
python3-k8sapp-cert-manager,
python3-k8sapp-cert-manager-wheels
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: stx-cert-manager-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Cert-Manager Armada Helm Charts
This package contains Armada helm charts for the certificate manager
application.

View File

@@ -0,0 +1,41 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: stx-cert-manager-helm
Source: https://opendev.org/starlingx/cert-manager-armada-app/
Files: *
Copyright: (c) 2013-2021 Wind River Systems, Inc
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2021 Wind River Systems, Inc
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.

View File

@@ -0,0 +1,56 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export ROOT = debian/tmp
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 APP_NAME = cert-manager
export APP_VERSION = $(MAJOR).$(MINOR_PATCH)
export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING = staging
%:
dh $@
override_dh_auto_build:
# Host a server for the helm 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 helm-charts && make psp-rolebinding
# Terminate the helm chart server.
pkill chartmuseum
# Setup the staging directory.
mkdir -p $(STAGING)
cp files/metadata.yaml $(STAGING)
cp manifests/*.yaml $(STAGING)
mkdir -p $(STAGING)/charts
cp helm-charts/*.tgz $(STAGING)/charts
cp /usr/lib/helm/cert*.tgz $(STAGING)/charts
# Populate metadata.
sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml
sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml
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
# Create the app package.
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar cfz $(APP_TARBALL) -C $(STAGING)/ .
# Cleanup staging
rm -rf $(STAGING)
override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(APP_FOLDER)
install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER)
override_dh_auto_test:
override_dh_usrlocal:

View File

@@ -0,0 +1 @@
3.0 (quilt)

View File

@@ -0,0 +1 @@
usr/local/share/applications/helm/*

View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -x
PKG_BUILD_NAME=$1
PKG_BUILD_ROOT=$(realpath `pwd`/${PKG_BUILD_NAME})
PKG_DIR="stx-cert-manager-helm"
STX_BASE=$(realpath ${MY_REPO}/stx)
SRC=$(realpath ${STX_BASE}/cert-manager-armada-app/${PKG_DIR}/${PKG_DIR})
PSP_HELM_CHARTS=$(realpath ${STX_BASE}/helm-charts/psp-rolebinding/psp-rolebinding/helm-charts)
mkdir -p ${PKG_BUILD_ROOT}
pushd ${PKG_BUILD_ROOT}
# Copy PSP rolebinding helm charts to the build directory.
cp -pr ${PSP_HELM_CHARTS} ${PKG_BUILD_ROOT}
cp -pr ${SRC}/files ${PKG_BUILD_ROOT}
cp -pr ${SRC}/helm-charts/Makefile ${PKG_BUILD_ROOT}/helm-charts
cp -pr ${SRC}/manifests ${PKG_BUILD_ROOT}

View File

@@ -0,0 +1,7 @@
---
debname: stx-cert-manager-helm
debver: 1.0-1
dl_hook: dl_hook
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true