From 221cfb126216f1c6740e1f518f8d865206e97249 Mon Sep 17 00:00:00 2001 From: kgridou <32600911+kgridou@users.noreply.github.com> Date: Sat, 6 Jun 2026 12:32:59 +0200 Subject: [PATCH] Fix Airflow migration-job race in CI deploys The migrateDatabaseJob/createUserJob TTL (300s) was shorter than the helm_release wait window (timeout = 900s). Under image-pull contention the migration job finishes early, then Helm keeps waiting on the slower webserver/scheduler pods. At the 300s mark the completed migration job is TTL-reaped, so Helm's final wait_for_jobs status check finds it gone and fails the release with: jobs.batch "airflow-run-airflow-migrations" not found Raise ttlSecondsAfterFinished to 1800s (> the 900s helm timeout) on both helper jobs so they survive the entire wait window and are still cleaned up afterwards. Co-Authored-By: Claude Opus 4.8 --- terraform/modules/airflow/main.tf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/terraform/modules/airflow/main.tf b/terraform/modules/airflow/main.tf index e326a1d..5ce26b5 100644 --- a/terraform/modules/airflow/main.tf +++ b/terraform/modules/airflow/main.tf @@ -35,16 +35,21 @@ resource "helm_release" "airflow" { replicas: 1 allowPodLogReading: true + # ttlSecondsAfterFinished MUST exceed the helm_release timeout below (900s). + # Otherwise, under image-pull contention the migration job can finish early + # while Helm is still waiting on the slower webserver/scheduler pods; the job + # is then TTL-reaped before Helm's wait_for_jobs status check runs, which + # fails the release with: jobs.batch "airflow-run-airflow-migrations" not found. migrateDatabaseJob: enabled: true useHelmHooks: false applyCustomEnv: false - ttlSecondsAfterFinished: 300 + ttlSecondsAfterFinished: 1800 createUserJob: useHelmHooks: false applyCustomEnv: false - ttlSecondsAfterFinished: 300 + ttlSecondsAfterFinished: 1800 postgresql: enabled: false