Skip to main content
Errand uses a simple dot-notation to reference named entities in a playbook. When you reference a block, Errand automatically ensures it runs before any block that depends on it.

Syntax

ReferenceRefers to
var.<name>A declared variable block
computed.<name>A declared computed block
task.<name>A declared task block

Where you can use references

In task commands

variable "version" {
  type = string
}

task "tag" {
  commands = [
    "git tag v${var.version}",
    "git push origin v${var.version}",
  ]
}

In computed expressions

variable "app" {
  type    = string
  default = "api"
}

computed "image" {
  expression = "${env("CI_REGISTRY", "registry.example.com")}/${var.app}"
}

In task conditions

variable "deploy" {
  type    = bool
  default = true
}

task "deploy" {
  condition = var.deploy
  commands  = ["./bin/deploy"]
}

In depends_on

depends_on takes a list of task.<name> references:
task "deploy" {
  depends_on = [task.build, task.test]
  commands   = ["./bin/deploy"]
}

Implicit vs explicit dependencies

Errand infers dependencies from references. If a task command uses var.version, Errand knows the variable must be resolved before the task runs. You do not need to list variables in depends_on. Use depends_on when the dependency is not expressed in a command or condition, such as an aggregate task:
task "ci" {
  depends_on = [task.lint, task.test, task.build]
  commands   = []
}

Cycle detection

Errand detects circular dependencies before execution begins and reports a Cyclic dependency error. Fix cycles by breaking the dependency chain or restructuring tasks.

Undefined references

Referencing a name that does not exist is an Undefined reference error. Errand validates all references before running any task.