Webhook icon
Fail icon
Labels icon
Dag icon
Request icon
Subflow icon
OutputValues icon
Set icon
Query icon
Loop icon
Kill icon
Log icon
SlackIncomingWebhook icon

Release readiness gate as a Dag with onChildFailure, parallel checks, a smoke-test Subflow and labels inherited by every child execution

Kestra blueprint for io.kestra.plugin.core.flow.Dag with dependsOn and onChildFailure, plus Subflow inheritLabels. A release readiness gate that checks GitHub, Docker Hub and a staging endpoint in parallel, cancels the graph on the first failure, kills orphaned child executions and writes a KV release record.

Categories
CoreInfrastructure

A release is ready when the git tag exists on GitHub, the container image with the same tag is on the registry and the staging deployment answers. io.kestra.plugin.core.flow.Dag runs the checks in parallel, starts a dependent child when the children it names have succeeded, and onChildFailure decides what the rest of the graph does when one check fails. The second idea is inheritLabels on Subflow: the release id is set as a label before the graph starts and every child execution carries it, so the Executions page filtered by release_id shows the gate and its children as one unit. The defaults point at the public Kestra release v2.0.5 and at httpbin, so the flow runs as is.

How it works

  1. validate_inputs (Fail with a condition) repeats the five checks rules, because webhook executions do not run flow-level checks on 2.0.5.
  2. label_release (Labels) sets release_id, release_version and release_status: running, before the Dag, because inheritLabels copies the labels the parent has when the child starts.
  3. release_graph (Dag, onChildFailure: CANCEL):
    • release_tag and container_tag (http.Request) read the tag on the GitHub API and the Docker Hub v2 API in parallel; a missing tag is a 404 and fails the child.
    • staging_smoke (Subflow) starts release-smoke-check with inheritLabels: true and labels: {environment: staging}, waits for it and fails if it fails (transmitFailed: true).
    • tag_labels (Labels, dependsOn: [release_tag]) sets release_channel to stable or prerelease as soon as GitHub answered, while the other two may still run.
    • compose_record (OutputValues, dependsOn all three checks) builds the release record from both API bodies and outputs.staging_smoke.outputs; record_release (kv.Set) writes it to release_<release_id> with record_ttl.
  4. The Dag errors branch runs the moment the Dag fails: still_running_children (executions.Query with triggerExecutionId) lists the executions this run started, kill_orphaned_children (Loop) calls executions.Kill on the ones still active.
  5. label_ready runs only when every child ended SUCCESS.

The child flow, to create in the same namespace:

id: release-smoke-check
namespace: company.team
description: One HTTP call to a deployed environment, pass or fail on the status code.

inputs:
  - id: release_id
    type: STRING
    defaults: unknown
  - id: environment
    type: STRING
    defaults: staging
  - id: url
    type: STRING
    defaults: https://httpbin.org/get
  - id: expected_status
    type: INT
    defaults: 200

tasks:
  - id: call
    type: io.kestra.plugin.core.http.Request
    uri: "{{ inputs.url }}"
    headers:
      X-Release-Id: "{{ inputs.release_id }}"
    options:
      allowFailed: true
      timeout:
        connectTimeout: PT5S
        readIdleTimeout: PT30S

  - id: verdict
    type: io.kestra.plugin.core.execution.Assert
    conditions:
      - "{{ outputs.call.code == inputs.expected_status }}"
    errorMessage: "{{ inputs.environment }} answered HTTP {{ outputs.call.code }} for release {{ inputs.release_id }}, expected {{ inputs.expected_status }}"

outputs:
  - id: status_code
    type: INT
    value: "{{ outputs.call.code }}"
  - id: environment
    type: STRING
    value: "{{ inputs.environment }}"
  - id: checked_at
    type: STRING
    value: "{{ execution.startDate }}"

What this blueprint teaches

  • Dag with dependsOn: the order comes from the dependencies, not from the position in the list. tag_labels waits for one child, compose_record for three.
  • onChildFailure: with CONTINUE the Dag resolves FAILED at once and its errors tasks run while the siblings finish; with CANCEL the running worker tasks end CANCELLED; with FAIL they end FAILED. Two facts measured on 2.0.5 and built into this flow: the property is rendered once per flow revision and memoised, so keep it a literal (an input would apply to the first run only); and a Subflow child is not interrupted, its execution keeps running, which is what the Dag errors branch cleans up.
  • Subflow with inheritLabels, wait, transmitFailed: the child receives the parent's labels, including the ones a Labels task added at runtime, plus the ones in labels; system.correlationId links parent and children for the machine, the inherited release_id is the filter a person types. wait: true makes the child's outputs and state visible to the parent; transmitFailed: true turns the child's failure into a Dag child failure, where the policy applies.
  • Dag-level errors: a flowable task has its own errors list, run before the flow-level one.

How to run

Run with the defaults: the run ends SUCCESS with labels release_status: ready and release_channel: stable, and the KV key release_2026.10-rc1 holds the record. Then filter Executions by label release_id = 2026.10-rc1: the gate and the release-smoke-check execution appear together. Secrets: KESTRA_API_USERNAME and KESTRA_API_PASSWORD for the cleanup, RELEASE_GATE_WEBHOOK_KEY for the trigger, SLACK_WEBHOOK_URL (optional, both Slack tasks have allowFailure: true). From CI, POST {"release_id": "...", "version": "..."} to the webhook URL.

Error handling

  • Bad inputs (spaces or capitals in the release id, latest as the version, a repository without an owner, a relative URL) are blocked by checks, and by validate_inputs for webhook executions.
  • A missing git or image tag is a 404 on that child. The Dag cancels the other running worker tasks, resolves FAILED and kills the still-running smoke-check execution; the flow errors branch labels the run release_status: failed with release_failed_task, writes release_<id>_failed to KV, logs an ERROR with the execution link and sends a Slack alert with the Executions filter link. The flow outputs stay null-safe.
  • A failing staging endpoint fails the verdict Assert in the child; the Subflow fails and the policy applies to the rest.
  • GitHub and Docker Hub 429, 502, 503 and 504 answers are retried three times (retryOnStatusCodes); a 404 is not retried, because it is the answer.
  • concurrency: QUEUE lines up gates for different releases. The MAX_DURATION SLA fails a run after 10 minutes and labels it release_sla: breached. Measured on 2.0.5: a breach kills everything still running, the smoke-check child execution included, and also the Dag errors branch and the afterExecution notification, so the label is the reliable signal.

How to adapt

  • Point staging_url at your health endpoint; add a production Subflow child with dependsOn: [staging_smoke] so smoke tests run in sequence while the registry checks stay parallel.
  • Use CONTINUE for a readiness report rather than a gate; the cleanup then kills nothing.
  • Point container_tag at GHCR or add a Helm or PyPI check as a fourth parallel child. Downstream deploy flows read kv('release_<id>').

See also

See How

New to Kestra?

Use blueprints to kickstart your first workflows.