Rei Oliveira d0b5a1b644 Debian: Add fluxcd app for ptp-notification
Add the fluxcd app for ptp-notification to the debian build.

Test Cases:

PASS: Check deb install and application upload + apply on debian
PASS: Check application remove and delete on debian

Logs: https://paste.opendev.org/show/bVFc2ewiTos3FQ1kOAq0/

Story: 2009138
Task: 44663
Signed-off-by: Rei Oliveira <Reinildes.JoseMateusOliveira@windriver.com>
Change-Id: I4ba0340ac51a73d655b9cf1d8972d43534f5a07c
2022-05-23 18:21:48 -03:00

75 lines
2.3 KiB
Makefile
Executable File

#!/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 = ptp-notification
export APP_VERSION = $(MAJOR).$(MINOR_PATCH)
export APP_TARBALL_ARMADA = $(APP_NAME)-armada-$(APP_VERSION).tgz
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_FOLDER = /usr/lib/helm
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 ptp-notification
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
# 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_ARMADA) -C $(STAGING)/ .
# Prepare staging for fluxcd package
rm -f $(STAGING)/ptp_notification_manifest.yaml
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
tar -zcf $(APP_TARBALL_FLUXCD) -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_ARMADA) $(APP_FOLDER)
install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER)
override_dh_usrlocal: