Update for automatic increment chart versions

Updating portieris for auto chart version incrementation. Restructuring
debian packaging, and separating portieris-certs into a new package.

Test Plan:
PASS	Validate each chart builds from a clean build env
PASS	Validate application tarball is created correctly
PASS	Validate chart version increments by 1 for each change
PASS	Validate application cycle (upload/apply/remove/delete) for
AIO-SX

Story: 2010929
Task: 50225

Change-Id: I8e6ce77b779f6c7ef4d4bad60f77e13cba53d867
Signed-off-by: Tae Park <tae.park@windriver.com>
This commit is contained in:
Tae Park 2024-05-30 08:56:19 -04:00
parent 419816d74a
commit e30c59ad79
33 changed files with 170 additions and 58 deletions
debian_pkg_dirs
helm-charts
portieris-helm/debian/deb_folder
stx-portieris-helm
debian/deb_folder
stx-portieris-helm/fluxcd-manifests
portieris-certs
portieris

@ -1,3 +1,4 @@
portieris-helm
helm-charts/upstream/portieris-helm
helm-charts/custom/portieris-certs-helm
python3-k8sapp-portieris
stx-portieris-helm

@ -0,0 +1,5 @@
portieris-certs-helm (0.1-0) unstable; urgency=medium
* Initial release.
-- Tae Park <tae.park@windriver.com> Thu, 30 May 2024 13:02:42 +0000

@ -0,0 +1,15 @@
Source: portieris-certs-helm
Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
helm
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: portieris-certs-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Portieris Certs Helm Charts
This package contains helm chart Portieris Certs for the portieris application.

@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: portieris-certs-helm
Source: https://opendev.org/starlingx/portieris-armada-app/
Files: *
Copyright: (c) 2020-2024 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'.

@ -0,0 +1,22 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export PATCH_VERSION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export PORTIERIS_BASE_VERSION = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-')
export PORTIERIS_VERSION = $(PORTIERIS_BASE_VERSION).$(PATCH_VERSION)
export ROOT = debian/tmp
export CHART_FOLDER = $(ROOT)/usr/lib/helm
%:
dh $@
override_dh_auto_build:
make CHART_VERSION=$(PORTIERIS_VERSION) portieris-certs
override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(CHART_FOLDER)
install -p -D -m 755 portieris-certs*.tgz $(CHART_FOLDER)

@ -0,0 +1,10 @@
---
debname: portieris-certs-helm
debver: 0.1-0
src_path: portieris-certs-helm
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/portieris-armada-app/helm-charts/custom/portieris-certs-helm
BASE_SRCREV: 419816d74a38e978a2743365052073719dc0cc8b

@ -1,7 +1,7 @@
#
# Copyright 2017 The Openstack-Helm Authors.
#
# Copyright (c) 2018 Wind River Systems, Inc.
# Copyright (c) 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -31,12 +31,11 @@ lint-%: init-%
if [ -d $* ]; then helm lint $*; fi
build-%: lint-%
if [ -d $* ]; then helm package $*; fi
if [ -d $* ]; then helm package --version $(CHART_VERSION) $*; fi
clean:
@echo "Clean all build artifacts"
rm -f */templates/_partials.tpl */templates/_globals.tpl
rm -f *tgz */charts/*tgz */requirements.lock
rm -rf */charts */tmpcharts
%:

@ -1,4 +1,4 @@
portieris-helm (1.0-1) unstable; urgency=medium
portieris-helm (0.13-10) unstable; urgency=medium
* Initial release.

@ -3,9 +3,8 @@ Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
chartmuseum,
helm,
procps
build-info
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io

@ -0,0 +1,24 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export PATCH_VERSION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export PORTIERIS_BASE_VERSION = $(shell echo $(DEB_VERSION) | sed 's/-/./' | cut -d '.' -f 1-3)
export PORTIERIS_VERSION = $(PORTIERIS_BASE_VERSION)+STX.$(PATCH_VERSION)
export PORTIERIS_TARBALL = portieris-$(PORTIERIS_VERSION).tgz
export ROOT = debian/tmp
export CHART_FOLDER = $(ROOT)/usr/lib/helm
%:
dh $@
override_dh_auto_build:
cp Makefile helm
cd helm && make CHART_VERSION=$(PORTIERIS_VERSION) portieris
override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(CHART_FOLDER)
install -p -D -m 755 helm/$(PORTIERIS_TARBALL) $(CHART_FOLDER)

@ -1,16 +1,18 @@
---
debname: portieris-helm
debver: 1.0-1
debver: 0.13-10
dl_path:
name: portieris-0.13.10.tgz
url: https://github.com/IBM/portieris/archive/refs/tags/v0.13.10.tar.gz
sha256sum: 8377029dc885bd50ff459ddc0d01aa274921b0024cc63bf969f2e72bf4b56f11
src_files:
- files/Makefile
- files/index.yaml
- files/repositories.yaml
revision:
dist: $STX_DIST
stx_patch: 1
PKG_GITREVCOUNT: true
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/portieris-armada-app/portieris-helm/files
SRC_DIR: ${MY_REPO}/stx/portieris-armada-app/helm-charts/upstream/portieris-helm/files
BASE_SRCREV: b2f895c371539899f7c9543c9c5dba8a897a1be3

@ -0,0 +1,41 @@
#
# Copyright 2017 The Openstack-Helm Authors.
#
# Copyright (c) 2019, 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# It's necessary to set this because some environments don't link sh -> bash.
SHELL := /bin/bash
TASK := build
EXCLUDES := doc tests tools logs tmp
CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
.PHONY: $(EXCLUDES) $(CHARTS)
all: $(CHARTS)
$(CHARTS):
@if [ -d $@ ]; then \
echo; \
echo "===== Processing [$@] chart ====="; \
make $(TASK)-$@; \
fi
init-%:
if [ -f $*/Makefile ]; then make -C $*; fi
lint-%: init-%
if [ -d $* ]; then helm lint $*; fi
build-%:
if [ -d $* ]; then helm package --version $(CHART_VERSION) $*; fi
clean:
@echo "Clean all build artifacts"
rm -f */templates/_partials.tpl */templates/_globals.tpl
rm -rf */charts */tmpcharts
%:
@:

@ -1,26 +0,0 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export ROOT = debian/tmp
export CHART_FOLDER = $(ROOT)/usr/lib/helm
export PORTIERIS_VERSION = v0.13.10
export PORTIERIS_TARBALL = portieris-$(PORTIERIS_VERSION).tgz
%:
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.
make helm.package
# 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 $(PORTIERIS_TARBALL) $(CHART_FOLDER)

@ -3,11 +3,9 @@ Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
chartmuseum,
helm,
portieris-helm,
procps,
python3-k8sapp-portieris,
portieris-certs-helm,
python3-k8sapp-portieris-wheels,
build-info
Standards-Version: 4.5.1
@ -17,6 +15,6 @@ Package: stx-portieris-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Portieris FluxCD Helm Charts
This package contains FluxCD helm charts for the portieris
Description: StarlingX Portieris FluxCD application.
This package contains FluxCD manifests for the portieris
application.

@ -19,26 +19,28 @@ 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 && helm lint portieris-certs
cd helm-charts && helm package portieris-certs
# Terminate the helm chart server.
pkill chartmuseum
# Setup the staging directory.
mkdir -p $(STAGING)
cp files/metadata.yaml $(STAGING)
mkdir -p $(STAGING)/charts
cp helm-charts/portieris*.tgz $(STAGING)/charts
cp $(HELM_FOLDER)/portieris*.tgz $(STAGING)/charts
# Prepare staging for fluxcd package
cp -R fluxcd-manifests $(STAGING)/
# Adjust the helmrelease yamls based on the chart versions
for c in $(STAGING)/charts/*; do \
chart=$$(basename $$c .tgz); \
chart_name=$${chart%-*}; \
chart_version=$${chart##*-}; \
echo "Found $$chart; name: $$chart_name, version: $$chart_version"; \
chart_manifest=$$(find $(STAGING)/fluxcd-manifests/$$chart_name -name helmrelease.yaml -exec grep -q $$chart_name {} \; -print); \
echo "Updating manifest: $$chart_manifest"; \
sed -i "s/REPLACE_HELM_CHART_VERSION/$$chart_version/g" $$chart_manifest; \
grep version $$chart_manifest; \
done
# Populate metadata.
sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING)/metadata.yaml
sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING)/metadata.yaml
@ -48,9 +50,6 @@ override_dh_auto_build:
mkdir -p $(STAGING)/plugins
cp /plugins/*.whl $(STAGING)/plugins
# Prepare staging for fluxcd package
cp -R fluxcd-manifests $(STAGING)/
# calculate checksum of all files in staging for the fluxcd app
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
# package fluxcd app

@ -15,7 +15,7 @@ spec:
chart:
spec:
chart: portieris-certs
version: 0.1.0
version: REPLACE_HELM_CHART_VERSION
sourceRef:
kind: HelmRepository
name: stx-platform

@ -15,7 +15,7 @@ spec:
chart:
spec:
chart: portieris
version: 0.13.10
version: REPLACE_HELM_CHART_VERSION
sourceRef:
kind: HelmRepository
name: stx-platform