Remove a pipelinerun if cleanup is about to start

This commit is contained in:
Nikolai Rodionov 2024-04-04 09:45:24 +02:00
parent 0d33733693
commit 3a55008066
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
2 changed files with 9 additions and 1 deletions

View File

@ -28,7 +28,12 @@ else
export SP_CUSTOMER_ID=$(jq -r .[0].object.metadata.namespace $BINDING_CONTEXT_PATH) export SP_CUSTOMER_ID=$(jq -r .[0].object.metadata.namespace $BINDING_CONTEXT_PATH)
export SP_ENVIRONMENT=$(jq -r .[0].object.metadata.name $BINDING_CONTEXT_PATH) export SP_ENVIRONMENT=$(jq -r .[0].object.metadata.name $BINDING_CONTEXT_PATH)
echo "removing the ${SP_ENVIRONMENT} owned by ${SP_CUSTOMER_ID}" echo "removing the ${SP_ENVIRONMENT} owned by ${SP_CUSTOMER_ID}"
# -- Remove the pipelinerun, if not removed yet
kubectl delete pipelinerun -n "${SP_TEKTON_RUNTIME_NS}" \
-l softplayer.net/user-uuid="${SP_CUSTOMER_ID}" \
-l softplayer.net/env_name="${SP_ENVIRONMENT}" || true
envsubst < /tpls/${SP_PROVIDER}-cleanup.yaml | kubectl create -f - envsubst < /tpls/${SP_PROVIDER}-cleanup.yaml | kubectl create -f -
# -- Removing the finalizer # -- Removing the finalizer

View File

@ -3,6 +3,9 @@ kind: PipelineRun
metadata: metadata:
generateName: hetzner-k3s generateName: hetzner-k3s
namespace: "${SP_TEKTON_RUNTIME_NS}" namespace: "${SP_TEKTON_RUNTIME_NS}"
labels:
softplayer.net/user-uuid: "${SP_CUSTOMER_ID}"
softplayer.net/env_name: "${SP_ENVIRONMENT}"
spec: spec:
params: params:
- name: namespace - name: namespace