Rei Oliveira 32f023b838 Fixing the debian package for version 0.41.2
The fluxcd version of the app will be added to the debian package in
story 2009138 task 44473.

Test Cases:

PASS: Debian package is built successfully.

Story: 2009836
Task: 44604

Signed-off-by: Rei Oliveira <Reinildes.JoseMateusOliveira@windriver.com>
Change-Id: If591edd61df3129a8447bb415bd38bf31b270ff4
2022-03-01 12:55:01 -03:00

65 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_PATCH = $(shell echo $(DEB_VERSION) | cut -f 2 -d '.')
export APP_NAME = nginx-ingress-controller
export APP_VERSION = $(MAJOR).$(MINOR_PATCH)
export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING = staging
export NGINX_PKG = helm-charts-ingress-nginx-0.41.2.tar.gz
%:
dh $@
override_dh_auto_build:
tar xfz $(NGINX_PKG)
# Move the extracted helm chart files to the top level build directory.
# Remove the helm-charts Makefile first so it doesn't overwrite our Makefile.
rm helm-charts/Makefile
mv helm-charts/* .
# Apply the daemonset tolerations patch.
patch --no-backup-if-mismatch --fuzz=0 -p1 < 0001-add-toleration-armada.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
# Create the TGZ file.
cp Makefile charts
cd charts && make ingress-nginx
# Terminate the helm chart server.
pkill chartmuseum
# Setup the staging directory.
mkdir -p $(STAGING)
cp metadata.yaml nginx_ingress_controller_manifest.yaml $(STAGING)
mkdir -p $(STAGING)/charts
cp 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) -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: