builtin:exec#
Runs a command on the host when the step starts, and optionally another command on teardown.
migrate: {
uses: "builtin:exec"
with: {
up: {command: ["./scripts/migrate.sh", "up"]}
down: {command: ["./scripts/migrate.sh", "down"]}
}
}To send the commands’ requests through the kevin proxy:
fetch: {
uses: "builtin:exec"
with: {
up: {command: ["curl", "-fsSL", "-o", "/tmp/asset.tar.gz", "https://example.com/asset.tar.gz"]}
proxy: true
egress: ["example.com"]
}
}For a tool that takes a CA file or proxy address only as a flag, use the project variables:
up: command: [
"curl", "--cacert", "${project.root_cert}",
"--proxy", "${project.http_proxy_addr}",
"https://internal.example.com",
]| Field | Type | Default | Description |
|---|---|---|---|
up | #Exec | - | Runs once when the step starts. A nonzero exit fails the step. Its stdout, with surrounding whitespace removed, is the "stdout" output. |
down | #Exec | - | Runs on teardown. Unset, teardown runs nothing. |
proxy | bool | - | Sets the proxy environment variables and the kevin CA for up and down, so their requests go through the kevin proxy and show in the console. |
egress | [...string] | - | Lists external hosts that the commands can reach when proxy.egress.deny is true. Has an effect only when proxy is true. |
#Exec#
| Field | Type | Default | Description |
|---|---|---|---|
command | [string, ...string] | - | Required. The program and its arguments. There is no shell: use ["sh", "-c", "..."] for shell features. |
cwd | string | - | The working directory. A relative path resolves against the project directory, which is also the default. |
env | [string]: string | - | Sets additional environment variables for the command. |
Outputs#
| Key | Value |
|---|---|
stdout | Standard output of up, with surrounding whitespace removed. |
Behavior#
- Supports export:
stdout, for asetup.<step>need or a command. Export returns the output of the lastupand does not run the command again. It fails ifuphas not run. - When you rerun a step that this step needs, kevin does not rerun this step, because the command might not be safe to run twice.