Skip to main content
A playbook is made up of four block types. Each has a distinct role in defining how a run behaves.

errand block

The errand block sets playbook-level configuration. It is optional and can appear at most once across all .ern files.

Attributes

working_dir
string
The default working directory for all tasks in the playbook. Tasks with their own working_dir override this value. Relative paths are resolved from the directory where errand was invoked.

Example

Both test and build run from ./service/api without repeating working_dir in each task.

Notes

  • If no errand block is declared, tasks run from the directory where errand was invoked unless they specify their own working_dir.
  • Declaring errand more than once is an error.

variable block

Variables are named inputs. Declare them in the playbook and pass values at run time with --var. Reference them as var.<name>.
All attributes are optional. A variable with no default is required: Errand reports an error if no value is provided.

Attributes

description
string
A human-readable description shown in error messages.
type
type constraint
A type constraint. When set, Errand validates and converts the provided value. See types for all available types.
default
any
The value used when no --var flag is passed. Must be compatible with type when both are set.

Passing values

Multiple --var flags are supported. Values are strings on the command line and converted to the declared type automatically.

Examples

Required variable, no default means it must be supplied:
Variable with a default:
Object variable, structured inputs keep related values together:
Pass an object from the command line:
The port field is omitted, so its default 5432 applies. Boolean variable used in a conditional command:

Notes

  • Variable names must be unique across all .ern files in the playbook.
  • Access object fields with dot notation: var.db.host.
  • Access list elements by index: var.services[0].

computed block

A computed block evaluates an expression at runtime and makes the result available as computed.<name>. Use it to derive values from variables, the environment, or built-in functions without duplicating logic across tasks.
expression is required. description is optional.

Attributes

description
string
A human-readable description of the computed value.
expression
expression
required
The expression to evaluate. Can reference variables (var.<name>), call built-in functions, and combine values with string interpolation.

Evaluation order

Computed blocks are evaluated before tasks run, in dependency order. If a computed block references a variable, that variable is resolved first automatically. If two computed blocks reference each other, Errand reports a cycle error.

Examples

Read from the environment with a fallback:
Build a value from multiple inputs:
Chain computed values: image_tag depends on version, so Errand evaluates version first:

Notes

  • Computed names must be unique across all .ern files in the playbook.
  • Computed values are read-only. Tasks cannot modify them.

task block

A task is a named group of shell commands. Tasks can depend on other tasks, run conditionally, and be scoped to a specific directory.
Only commands is required.

Attributes

description
string
A human-readable description of what the task does.
working_dir
string
The directory to run commands in. Overrides the playbook-level working_dir from the errand block. Relative paths are resolved from the directory where errand was invoked.
condition
boolean expression
A boolean expression. When it evaluates to false, the task is skipped. Tasks that depend on a skipped task are also skipped.
depends_on
list of task references
An explicit list of tasks that must complete before this task runs. Write each as task.<name>. Errand also infers dependencies from expression references in commands and condition.
commands
list of string expressions
required
Shell commands to execute in order. Each command is a string expression and can use variables, computed values, and built-in functions. Commands stop at the first failure.

Examples

Task with dependencies, Errand runs test and lint before build:
Conditional task, skip when a lock file is absent:
Aggregate task, runs dependencies only, no commands of its own:

Default task

When you call errand run with no task name, Errand runs the task named default:

Notes

  • Task names must be unique across all .ern files in the playbook.
  • Commands run inside a built-in POSIX-compatible shell interpreter. No external shell is required, including on Windows.
  • If a command fails, remaining commands in the same task are skipped and the task is marked as failed.
  • Tasks that do not depend on a failed task continue to run normally.