Merge pull request #1168 from pikasTech/fix/1148-stuck-argo-hook-cleanup

fix: clean stuck Argo hook image pull jobs
This commit is contained in:
Lyon
2026-06-27 23:06:19 +08:00
committed by GitHub
+5 -1
View File
@@ -503,8 +503,12 @@ export function nodeRuntimeSync(scoped: ReturnType<typeof parseNodeScopedDelegat
" tracking=$(kubectl -n \"$runtime_namespace\" get \"$job\" -o go-template='{{ index .metadata.annotations \"argocd.argoproj.io/tracking-id\" }}' 2>/dev/null || true)",
" failed=$(kubectl -n \"$runtime_namespace\" get \"$job\" -o go-template='{{ range .status.conditions }}{{ if or (eq .type \"Failed\") (eq .type \"FailureTarget\") }}{{ .status }} {{ end }}{{ end }}' 2>/dev/null || true)",
" case \"$tracking\" in \"$app:\"*) ;; *) continue ;; esac",
" case \"$failed\" in *True*) ;; *) continue ;; esac",
" hook_name=${job#job.batch/}",
" waiting=$(kubectl -n \"$runtime_namespace\" get pod -l \"job-name=$hook_name\" -o 'jsonpath={range .items[*].status.containerStatuses[*]}{.state.waiting.reason}{\" \"}{end}' 2>/dev/null || true)",
" case \"$failed\" in",
" *True*) ;;",
" *) case \"$waiting\" in *ImagePullBackOff*|*ErrImagePull*|*CrashLoopBackOff*) ;; *) continue ;; esac ;;",
" esac",
" failed_hook_count=$((failed_hook_count + 1))",
" if [ -z \"$failed_hooks\" ]; then failed_hooks=$hook_name; else failed_hooks=$failed_hooks,$hook_name; fi",
" if [ \"$dry_run\" = false ]; then",