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}"
}
}
| Field | Type | Default | Description |
|---|
timeout | string | "60s" | The total time to wait for the check to succeed. |
interval | string | "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. |
duration | string | - | 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#
| Field | Type | Default | Description |
|---|
address | string | - | 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#
| Field | Type | Default | Description |
|---|
url | string | - | Required. The address to request, such as "http://${needs.api.out.host_8080}/healthz". |
method | string | "GET" | The HTTP method to use. |
status | int | 200 | The response status code that counts as ready. |
#Kubectl#
| Field | Type | Default | Description |
|---|
kubeconfig | string | - | Required. A path, or a "${...}" expression that reads one from needs, such as "${needs.cluster.out.kubeconfig}". |
context | string | - | Selects the kubeconfig context. Defaults to the kubeconfig’s current-context. |
namespace | string | - | The target namespace. |
resource | string | - | Required. The target, such as "pod/mypod" or "deployment/api". |
for | string | - | The condition to wait for, passed to kubectl wait –for=, such as "condition=Ready". |
rollout | bool | - | Runs kubectl rollout status against resource instead of kubectl wait. |
Set exactly one of for and rollout.
#Exec#
| Field | Type | Default | Description |
|---|
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.