Leonardo Fagundes Luz Serrano 441d44eb2f 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: 47192

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: I73712a6b41639829cd56a02781bd8d80337a372a
2023-01-20 15:41:02 +00:00

77 lines
2.2 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 = $(shell echo $(DEB_VERSION) | cut -f 2 -d '.')
export APP_NAME = oran-o2
export APP_VERSION = $(MAJOR).$(MINOR)
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING_FLUXCD = staging-fluxcd
export FLUXCD_O2_PKG = oran-o2-2.0.0_g39e022d7.tar.gz
%:
dh $@
override_dh_auto_build:
############
# FLUXCD #
############
mkdir -p fluxcd
mkdir -p ${APP_NAME}
tar -C ${APP_NAME} --strip-components=1 -xvf $(FLUXCD_O2_PKG)
# Host a server for the helm charts.
cd fluxcd; 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.
mkdir -p fluxcd/charts/${APP_NAME}
mv ${APP_NAME}/charts/* fluxcd/charts/${APP_NAME}
cp files/Makefile fluxcd/charts
cd fluxcd/charts && make ${APP_NAME}
# Terminate the helm chart server.
pkill chartmuseum
# Setup the staging directory.
mkdir -p $(STAGING_FLUXCD)
cp files/metadata.yaml $(STAGING_FLUXCD)
mkdir -p $(STAGING_FLUXCD)/charts
cp fluxcd/charts/*.tgz $(STAGING_FLUXCD)/charts
# Populate metadata.
sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING_FLUXCD)/metadata.yaml
sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING_FLUXCD)/metadata.yaml
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING_FLUXCD)/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING_FLUXCD)/plugins
cp /plugins/*.whl $(STAGING_FLUXCD)/plugins
cp -R fluxcd-manifests $(STAGING_FLUXCD)/
# calculate checksum of all files in app_staging
cd $(STAGING_FLUXCD) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar cfz $(APP_TARBALL_FLUXCD) -C $(STAGING_FLUXCD)/ .
# Cleanup staging
rm -rf $(STAGING_FLUXCD)
override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(APP_FOLDER)
install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER)
override_dh_auto_test:
override_dh_usrlocal: