Webhook icon
Assert icon
Trigger icon
Query icon
Wait icon
If icon
Log icon
Signal icon
SlackIncomingWebhook icon
Fail icon

Temporal Worker Canary Verification and Traffic Promotion Gate

Run a Temporal canary workflow on an isolated task queue, check its health query, and signal your traffic router to promote a new worker only if it completes.

Categories
Infrastructure

Checks a new Temporal worker build before it takes production traffic. CI calls a webhook with the new version. The flow starts a canary workflow on a task queue that only the candidate worker polls, calls a query handler on it, waits for it to complete, and only then sends a promoteWorkerVersion signal to your traffic router workflow. A canary that fails, times out or cannot be queried stops the release and alerts Slack.

What this proves is that the new build starts, polls the canary queue, registers the canary workflow and its query handler, and runs the workflow and its activities to completion. It does not prove replay determinism. Non-determinism errors appear when a worker replays the histories of workflows that are already running, and a fresh canary never replays old history. Keep replay tests of exported histories in your CI as well.

How it works

  1. ci_worker_build_webhook (io.kestra.plugin.core.trigger.Webhook) receives worker_version in the JSON body. Manual runs use the worker_version input. validate_parameters (io.kestra.plugin.core.execution.Assert) rejects values that are not a plain version or name, because the version ends up in a task queue name and in the promotion signal.
  2. start_canary_workflow (io.kestra.plugin.temporal.workflow.Trigger) starts canary_workflow_type on the queue <task_queue>-canary-<worker_version>, with a workflow ID that contains the Kestra execution ID, and an execution timeout of canary_timeout_minutes.
  3. probe_canary_health (io.kestra.plugin.temporal.workflow.Query) calls health_query_type on that run. The query only succeeds when a worker of the candidate build is serving the queue, and its answer is logged.
  4. wait_for_canary_completion (io.kestra.plugin.temporal.workflow.Wait) polls every five seconds until the canary reaches a terminal state or canary_timeout_minutes passes. A timeout fails the execution.
  5. evaluate_canary_success (io.kestra.plugin.core.flow.If) checks for COMPLETED.
    • Completed: signal_traffic_promotion (io.kestra.plugin.temporal.workflow.Signal) sends promoteWorkerVersion with a JSON argument {promotedVersion, taskQueue, approvedBy} to traffic_router_workflow_id, and Slack is notified.
    • Any other state: alert_canary_failed posts to Slack and abort_execution (Fail) fails the run with the canary's final state.
  6. The errors handler alerts Slack for failures such as an unreachable Temporal frontend, a failed query or a timeout. In all failure cases no promotion signal is sent.

What you get

  • A release gate that stops a build that cannot start, register or run its workflows before it takes traffic.
  • A canary that runs on its own queue, so no production workflow is touched.
  • No promotion signal on any failure path, and a Slack alert for each of them.
  • Only one gate execution runs at a time, so two builds cannot race to promote.

Who it's for

  • Platform Engineers: Teams that deploy Temporal worker fleets from CI.
  • Site Reliability Engineers: Teams that want a smoke gate before routing production traffic to a new build.
  • Backend Engineers: Teams that own workflows and want a quick end-to-end check of each build.

Why orchestrate this with Kestra

  • One execution per build: The webhook call, the Temporal calls and the Slack messages share one execution history with the version and run IDs.
  • Native Temporal tasks: Trigger, Query, Wait and Signal talk to the Temporal frontend directly, with no CLI wrapper.
  • Explicit failure paths: Every failure ends in an alert and a failed execution, and the promotion signal is only reachable after COMPLETED.

Prerequisites

  • A reachable Temporal frontend, such as Temporal Cloud or a self-hosted cluster.
  • A candidate worker build already polling <task_queue>-canary-<worker_version>, with the canary workflow and its query handler registered.
  • A running router workflow that handles the promoteWorkerVersion signal. This blueprint only sends the signal. Acting on it is up to your router.
  • A Slack Incoming Webhook URL.

Secrets

  • TEMPORAL_ENDPOINT: Host and port of the Temporal frontend, such as temporal.internal:7233.
  • TEMPORAL_CANARY_WEBHOOK_KEY: Key that protects the webhook URL.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL.

Quick start

  1. Add the three secrets to your Kestra namespace.
  2. Import this blueprint and run it manually with worker_version, task_queue, canary_workflow_type, traffic_router_workflow_id and health_query_type set, while the candidate worker is polling the canary queue.
  3. Check your router to see that it received the promotion signal.
  4. For CI, give the five inputs defaults in the flow and have your pipeline POST {"worker_version": "v2.4.1"} to the webhook URL shown for ci_worker_build_webhook.

How to extend

  • Scale the candidate first: Add a Kubernetes task before the canary that scales up the candidate worker deployment.
  • More canaries: Run several canary workflow types in a Loop to cover more activities.
  • Temporal Cloud mTLS: Set apiKey, or caCert, clientCert and clientKey, on each Temporal task.
  • Page on failure: Add a PagerDuty task next to the Slack alert.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.