From 6d4e07488190d189aae7080100b80090d37fe2ce Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2026 19:21:45 +0000 Subject: [PATCH 1/3] Clean up stale Kubernetes jobs before helm upgrade in release deployment Previous failed deployments leave hook jobs (e.g. DB migrations) behind in the codacy-release namespace. When helm tries to run the same post-upgrade hook on the next attempt it finds an already-failed job and immediately reports BackoffLimitExceeded, causing the deploy_to_doks_release CI job to fail (see job 30795). Add a clean_jobs Makefile target that deletes all jobs in the namespace before the helm upgrade runs. The codacy-release namespace is a dedicated Helm release namespace, so any lingering jobs are stale hook artifacts from prior failed runs and are safe to remove. AI-Generated: true --- .do/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.do/Makefile b/.do/Makefile index 0f2c7c07..de24ee8d 100644 --- a/.do/Makefile +++ b/.do/Makefile @@ -87,8 +87,12 @@ deploy_to_doks_infrastructure: set_cluster_context update_dependencies helm_inst .PHONY: deploy_to_doks_from_local_dir deploy_to_doks_from_local_dir: set_cluster_context update_dependencies helm_install_from_local_dir +.PHONY: clean_jobs +clean_jobs: + -kubectl delete jobs --all -n ${NAMESPACE} --ignore-not-found=true + .PHONY: deploy_to_doks_from_chartmuseum -deploy_to_doks_from_chartmuseum: set_cluster_context setup_helm_repos helm_install_from_chart_museum +deploy_to_doks_from_chartmuseum: set_cluster_context setup_helm_repos clean_jobs helm_install_from_chart_museum .PHONY: set_cluster_context set_cluster_context: From eaab55716b86d79831582ab09532074de0f1ba60 Mon Sep 17 00:00:00 2001 From: Ricardo Bernardino Date: Mon, 31 Aug 2026 21:13:41 +0100 Subject: [PATCH 2/3] Apply suggestion from @codacy-production[bot] Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com> --- .do/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.do/Makefile b/.do/Makefile index de24ee8d..bbb06133 100644 --- a/.do/Makefile +++ b/.do/Makefile @@ -85,7 +85,7 @@ update_ingress_values: deploy_to_doks_infrastructure: set_cluster_context update_dependencies helm_install_infrastructure .PHONY: deploy_to_doks_from_local_dir -deploy_to_doks_from_local_dir: set_cluster_context update_dependencies helm_install_from_local_dir +deploy_to_doks_from_local_dir: set_cluster_context update_dependencies clean_jobs helm_install_from_local_dir .PHONY: clean_jobs clean_jobs: From 8c5061da59b5052e755f4808d19179c8ff5e8303 Mon Sep 17 00:00:00 2001 From: Ricardo Bernardino Date: Mon, 31 Aug 2026 21:19:48 +0100 Subject: [PATCH 3/3] Reduce the delete jobs scope --- .do/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.do/Makefile b/.do/Makefile index bbb06133..0872a6b5 100644 --- a/.do/Makefile +++ b/.do/Makefile @@ -89,7 +89,7 @@ deploy_to_doks_from_local_dir: set_cluster_context update_dependencies clean_job .PHONY: clean_jobs clean_jobs: - -kubectl delete jobs --all -n ${NAMESPACE} --ignore-not-found=true + -kubectl delete jobs -l app.kubernetes.io/instance=${RELEASE_NAME} --ignore-not-found=true .PHONY: deploy_to_doks_from_chartmuseum deploy_to_doks_from_chartmuseum: set_cluster_context setup_helm_repos clean_jobs helm_install_from_chart_museum