Reed, Joshua c412f1b229 Update app Zuul Check Jobs.
Modify code to conform to flake8 and pylint.

Jobs are now flake8, pylint, py39 and metadata.

Test Plan
PASS - All zuul jobs pass as expected.

Story: 2010929
Task: 49275

Change-Id: I1b6389e43fc77ad2fcf8507d84e6f3da1caf8c85
Signed-off-by: Reed, Joshua <Joshua.Reed@windriver.com>
2023-12-18 09:08:13 -07:00

80 lines
2.4 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 RELEASE = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-')
export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export APP_NAME = nginx-ingress-controller
export APP_VERSION = $(RELEASE)-$(REVISION)
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING_FLUXCD = staging-fluxcd
export FLUXCD_NGINX_PKG = helm-charts-ingress-nginx-1.9.3.tar.gz
%:
dh $@
override_dh_auto_build:
############
# FLUXCD #
############
mkdir -p fluxcd
cd fluxcd ; \
tar xvfz ../$(FLUXCD_NGINX_PKG) ; \
rm helm-charts/Makefile ; \
mv -f helm-charts/* .
# Apply the daemonset tolerations patch to fluxcd
cd fluxcd ; patch --no-backup-if-mismatch --fuzz=0 -p1 < ../files/0001-add-toleration-fluxcd.patch ; \
# 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.
cp files/Makefile fluxcd/charts
cd fluxcd/charts && make ingress-nginx
# 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_REPLACE_NAME/$(APP_NAME)/g' $(STAGING_FLUXCD)/metadata.yaml
sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING_FLUXCD)/metadata.yaml
sed -i 's/HELM_REPLACE_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: