DbtCLI icon
Docker icon
TelegramSend icon
Pause icon
Schedule icon

dbt Core Production Build with an Approval Gate

Run dbt Core CI builds and tests, pause for human approval, then promote to the production target. Orchestrate dbt Core deployments with Kestra.

Categories
Data

Promote a dbt Core build to production behind a human approval gate. This blueprint runs dbt build against your CI target, tests the models, then pauses the execution until someone signs off before running dbt build against the production target. Because the approval sits between the two builds, production models are only refreshed after CI tests pass and a reviewer approves, giving data teams a safe, auditable promotion path for analytics engineering pipelines without relying on manual deploy scripts.

How it works

  1. The build_ci task (io.kestra.plugin.dbt.cli.DbtCLI) runs on a Docker task runner using the ghcr.io/kestra-io/dbt-duckdb image. With namespaceFiles enabled, it loads your dbt project, runs dbt deps, then dbt build --target ci to compile, run, and test models against the CI target.
  2. The notify_approval task (io.kestra.plugin.telegram.TelegramSend) posts a message to your Telegram channel announcing that CI passed and the production build is paused for review, including the {{ execution.id }}.
  3. The approve_production task (io.kestra.plugin.core.flow.Pause) halts the execution for up to {{ inputs.approval_timeout }} (default PT2H), waiting for a human to resume it.
  4. After approval, the build_production task runs dbt build --target prod, refreshing production models.
  5. A disabled Schedule trigger (scheduled_build, cron 0 2 * * *) is included so you can run the pipeline on a nightly cadence.

What you get

  • A two-stage CI-then-prod dbt Core build with a mandatory human checkpoint in between.
  • Automatic failure before the gate if data quality tests fail on the CI target.
  • Telegram notifications that tell reviewers exactly when and what to approve.
  • A configurable approval timeout so stalled reviews do not block forever.

Who it's for

  • Analytics engineers who want CI validation before touching production data.
  • Data platform teams enforcing change control on dbt deployments.
  • Anyone migrating from ad hoc dbt run scripts to governed, observable promotions.

Why orchestrate this with Kestra

dbt Core ships a transformation engine but no scheduler, no approval workflow, and no event triggers. Kestra adds the missing orchestration layer: declarative YAML pipelines, event and schedule triggers, automatic retries, and full execution lineage across every run. The Pause task gives you a native human-in-the-loop gate that dbt Core simply cannot express on its own, and namespace files keep your dbt project versioned alongside the flow.

Prerequisites

  • A dbt project with ci and prod targets defined in profiles.yml, uploaded as namespace files (warehouse credentials live in the dbt profile, so no extra Kestra secret is needed for the build itself).
  • A Telegram bot and the chat or channel ID you want to notify.

Secrets

  • TELEGRAM_TOKEN: Telegram Bot API token used for the approval notification.
  • TELEGRAM_CHANNEL: Telegram chat or channel ID to notify.

Quick start

  1. Upload your dbt project (with ci and prod targets) to the namespace as namespace files.
  2. Add the TELEGRAM_TOKEN and TELEGRAM_CHANNEL secrets.
  3. Run the flow manually, or enable the scheduled_build Schedule trigger for a nightly cadence.
  4. When CI passes, resume the paused execution to build the production target.

How to extend

  • Replace the Schedule trigger with a GitHub webhook to promote on merged pull requests.
  • Swap the dbt-duckdb image for your warehouse image (Snowflake, BigQuery, Postgres) and adjust profiles.yml.
  • Add a Slack or email notification alongside Telegram, or route approvals to specific reviewers.
  • For dbt Cloud, use the dbt-cloud-approval-gate blueprint instead.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.