builtin:wait#

Waits until a check succeeds, so that the steps that need it start only when a dependency is ready. The check is a TCP connection, an HTTP request, kubectl wait or kubectl rollout status, a command, or a fixed delay. See Deploying workloads.

app_ready: {
    uses: "builtin:wait"
    needs: ["cluster", "app"]
    with: {
        timeout: "2m"
        kubectl: {
            kubeconfig: "${needs.cluster.out.kubeconfig}"
            context:    "${needs.cluster.out.context}"
            resource:   "deployment/app"
            rollout:    true
        }
    }
}

To check a service inside a builtin:kubernetes cluster, use the expose_<name> system value of an expose entry:

postgres_ready: {
    uses: "builtin:wait"
    needs: ["cluster", "postgres"]
    with: {
        timeout: "2m"
        tcp: address: "${needs.cluster.system.expose_postgres}"
    }
}
FieldTypeDefaultDescription
timeoutstring"60s"The total time to wait for the check to succeed.
intervalstring"1s"How often to retry the check. It also bounds each individual attempt: a dial, a request, a kubectl call, or a command run.
tcp#TCP-Dials address until it accepts a connection.
http#HTTP-Requests url until it returns the expected status.
kubectl#Kubectl-Runs kubectl wait or kubectl rollout status against an existing cluster.
exec#Exec-Retries a command until it exits zero.
durationstring-Sleeps for a fixed amount of time, such as "5s", instead of checking anything. timeout and interval do not apply to it.

Set exactly one of tcp, http, kubectl, exec, and duration.

#TCP#

FieldTypeDefaultDescription
addressstring-Required. A host:port to connect to, or a "socks5://<relay>/<host:port>" address from an "expose_<name>" system value, which connects through the relay.

#HTTP#

FieldTypeDefaultDescription
urlstring-Required. The address to request, such as "http://${needs.api.out.host_8080}/healthz".
methodstring"GET"The HTTP method to use.
statusint200The response status code that counts as ready.

#Kubectl#

FieldTypeDefaultDescription
kubeconfigstring-Required. A path, or a "${...}" expression that reads one from needs, such as "${needs.cluster.out.kubeconfig}".
contextstring-Selects the kubeconfig context. Defaults to the kubeconfig’s current-context.
namespacestring-The target namespace.
resourcestring-Required. The target, such as "pod/mypod" or "deployment/api".
forstring-The condition to wait for, passed to kubectl wait –for=, such as "condition=Ready".
rolloutbool-Runs kubectl rollout status against resource instead of kubectl wait.

Set exactly one of for and rollout.

#Exec#

FieldTypeDefaultDescription
command[string, ...string]-Required. The program and its arguments. There is no shell: use ["sh", "-c", "..."] for shell features.

Behavior#

  • Creates nothing, and does nothing on teardown.
  • Safe to run again.