Skip to content

Commit 4083e67

Browse files
added loggin
1 parent 796909f commit 4083e67

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

charts/gitops-runtime/templates/hooks/pre-uninstall/cleanup-resources.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@ spec:
2020
command: ["sh", "-c"]
2121
args:
2222
- |
23-
# Remove finalizers from internal Argo CD Applications in this runtime namespace
23+
set -e
24+
25+
echo "[cleanup] Namespace: {{ .Release.Namespace }}"
26+
27+
echo "[cleanup] Patching internal Argo CD Applications finalizers..."
2428
kubectl get applications -n {{ .Release.Namespace }} -l codefresh.io/internal=true -o jsonpath='{.items[*].metadata.name}' \
25-
| xargs -r -n1 -I{} kubectl patch application -n {{ .Release.Namespace }} {} -p '{"metadata":{"finalizers":null}}' --type=merge || true
29+
| xargs -r -n1 -I{} sh -c 'echo "[cleanup] Patching application: {}"; kubectl patch application -n {{ .Release.Namespace }} {} -p '\''{"metadata":{"finalizers":null}}'\'' --type=merge' \
30+
|| echo "[cleanup] Failed to patch applications (see errors above)"
2631
27-
# Delete runtime token secret in this namespace (if present)
28-
kubectl delete secret codefresh-token -n {{ .Release.Namespace }} --ignore-not-found || true
32+
echo "[cleanup] Deleting codefresh-token secret..."
33+
kubectl delete secret codefresh-token -n {{ .Release.Namespace }} --ignore-not-found \
34+
|| echo "[cleanup] Failed to delete codefresh-token (see errors above)"
2935
30-
# Delete default git integration secret in this namespace (if present)
31-
kubectl delete secret -n {{ .Release.Namespace }} -l 'io.codefresh.integration-type=git,io.codefresh.integration-name=default' --ignore-not-found || true
36+
echo "[cleanup] Deleting default git integration secrets..."
37+
kubectl delete secret -n {{ .Release.Namespace }} -l 'io.codefresh.integration-type=git,io.codefresh.integration-name=default' --ignore-not-found \
38+
|| echo "[cleanup] Failed to delete default git integration secrets (see errors above)"
3239
{{- with .Values.installer.nodeSelector | default .Values.global.nodeSelector }}
3340
nodeSelector: {{ toYaml . | nindent 8 }}
3441
{{- end }}

0 commit comments

Comments
 (0)