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",
]
FieldTypeDefaultDescription
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.
proxybool-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#

FieldTypeDefaultDescription
command[string, ...string]-Required. The program and its arguments. There is no shell: use ["sh", "-c", "..."] for shell features.
cwdstring-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#

KeyValue
stdoutStandard output of up, with surrounding whitespace removed.

Behavior#

  • Supports export: stdout, for a setup.<step> need or a command. Export returns the output of the last up and does not run the command again. It fails if up has 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.