Skip to content

Task file format ​

The task file follows the Taskfile layout. It can be written in YAML, JSON or TOML with the same keys.

File names ​

Stackctl looks in the current directory and uses the first file it finds, in this order:

  1. stackctl.yml
  2. stackctl.yaml
  3. stackctl.json
  4. stackctl.toml
  5. Taskfile.yml
  6. Taskfile.yaml
  7. Taskfile.json
  8. Taskfile.toml

Parent directories are not searched. Use -f <path> to point at any file. The format is chosen from the file extension.

Top-level keys ​

KeyTypeDescription
versionstringSchema version, for example "3". Informational.
varsmap<string,string>Global template variables
envmap<string,string>Global environment variables
tasksmap<string,task>The tasks

Task ​

FieldTypeDescription
descstringDescription shown in list and the selector
aliaseslist of stringsAlternative names for the task
cmdstringA single command. Runs before cmds.
cmdslist of commandsCommands to run in order
depslist of stringsTasks to run first, in parallel, once per run
dirstringWorking directory, relative to the task file. Templated.
varsmap<string,string>Variables for this task
envmap<string,string>Environment variables for this task. Values are templated.
silentboolDo not echo this task's commands
ignore_errorboolContinue when a command in this task fails

Command entries ​

Each item in cmds is a string, or an object:

FieldTypeDescription
cmdstringThe shell command
taskstringRun another task (name or alias) instead of a command
silentboolDo not echo this command
ignore_errorboolContinue if this command or task fails

Use either cmd or task in one entry.

yaml
cmds:
  - go test ./...
  - task: build
  - cmd: echo done
    silent: true
json
{
  "cmds": [
    "go test ./...",
    { "task": "build" },
    { "cmd": "echo done", "silent": true }
  ]
}
toml
cmds = [
  "go test ./...",
  { task = "build" },
  { cmd = "echo done", silent = true },
]

Execution order ​

For a task, Stackctl:

  1. Resolves the name (exact task names win over aliases).
  2. Runs all deps in parallel, once each. If any fail, it stops.
  3. Merges vars (global, task, command line) and env (global, task).
  4. Runs cmd (if set), then each entry in cmds in order.

Validation ​

Loading fails with an error when:

  • the file extension is not .yml, .yaml, .json or .toml
  • the file cannot be parsed
  • an alias matches a task name, or two tasks use the same alias

At run time, an unknown task or a dependency cycle is an error.

Not supported ​

These Taskfile features are not implemented: sources / generates, status, preconditions, includes, dotenv, dynamic variables (sh:), and cmd as an object.

Released under the MIT License.