From 8e952f21da41203ab35956da0ae11e8d5e732d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20Echterh=C3=B6lter?= Date: Sun, 9 Feb 2025 10:12:46 +0100 Subject: [PATCH] fix(local-setup): improve cleanup process in start.sh and update repository version --- .gitignore | 2 +- .../kustomize/components/openmfp/repository.yaml | 2 +- local-setup/scripts/start.sh | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 84abf8a0..eaf5d7f5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ .secret bin/ node_modules/ -./oci/ \ No newline at end of file +oci/ \ No newline at end of file diff --git a/local-setup/kustomize/components/openmfp/repository.yaml b/local-setup/kustomize/components/openmfp/repository.yaml index f09c27cc..22e18516 100644 --- a/local-setup/kustomize/components/openmfp/repository.yaml +++ b/local-setup/kustomize/components/openmfp/repository.yaml @@ -8,6 +8,6 @@ spec: url: oci://ghcr.io/openmfp/helm-charts/openmfp ref: # renovate: datasource=docker registryUrl=https://ghcr.io depName=ghcr.io/openmfp/helm-charts/openmfp - semver: 0.0.200 + semver: 0.0.206 secretRef: name: ghcr-credentials diff --git a/local-setup/scripts/start.sh b/local-setup/scripts/start.sh index 65b6c293..a40a7fe7 100755 --- a/local-setup/scripts/start.sh +++ b/local-setup/scripts/start.sh @@ -62,7 +62,14 @@ if [ "${1}" == "oci" ]; then kubectl port-forward svc/registry 5000:5000 --context kind-openmfp & sleep 1 - for dir in "oci/"; do + cleanup() { + echo -e "${COL}[$(date '+%H:%M:%S')] Cleaning up background processes ${COL_RES}" + pkill -f "kubectl port-forward svc/registry 5000:5000" + } + trap cleanup EXIT + + OCIDIR=$SCRIPT_DIR/../../oci + for dir in $OCIDIR; do if [ -d "$dir" ]; then echo -e "${COL}[$(date '+%H:%M:%S')] Listing files in directory: $dir ${COL_RES}" for file in "$dir"/*; do @@ -76,9 +83,6 @@ if [ "${1}" == "oci" ]; then exit 1 fi done - - # kill the port-forward process - pkill -f "kubectl port-forward svc/registry 5000:5000" else kubectl apply -k $SCRIPT_DIR/../kustomize/overlays/default fi