DOC_INDEX
THEME
DOCS/Migrating to OrchStep/From Task

From Task

Translate a go-task Taskfile.yml into an OrchStep workflow - tasks, cmds, deps, vars, and Go template interpolation.

If you use Task (go-task) with a Taskfile.yml, OrchStep is the closest cousin of all the runners: both are YAML, both use Go templates, and tasks: is literally the same top-level key. The migration is mostly a search-and-replace on how variables are referenced, plus deciding whether dependencies should stay parallel or become ordered.

The 30-second version

task build                                  ->   orchstep run build
task --list                                 ->   orchstep list-tasks
task deploy VERSION=2.1.0 ENVIRONMENT=prod  ->   orchstep run deploy --var version=2.1.0 --var environment=prod

How the concepts map

TaskOrchStep
tasks:tasks: (same key)
cmds:steps: (func: shell with do:)
deps: (runs in parallel)A parallel: block (or sequential task: steps for ordering)
vars:defaults:
{{.VAR}} (dot-rooted Go template){{ vars.VAR }}
preconditions:An assert step
task --outputorchstep run --output

Side by side

TASKFILE.YML
version: '3'

vars:
  VERSION: "1.0.0"
  ENVIRONMENT: "staging"

tasks:
  build:
    cmds:
      - echo "building v{{.VERSION}}"
  test:
    cmds:
      - echo "running tests"
  deploy:
    cmds:
      - echo "deploying v{{.VERSION}} to {{.ENVIRONMENT}}"
  ci:
    deps: [test, build]
ORCHSTEP.YML
name: app
desc: Build, test, and deploy the app

defaults:
  version: "1.0.0"
  environment: "staging"

tasks:
  build:
    steps:
      - name: compile
        func: shell
        do: echo "building v{{ vars.version }}"
  test:
    steps:
      - name: unit
        func: shell
        do: echo "running tests"
  deploy:
    steps:
      - name: ship
        func: shell
        do: echo "deploying v{{ vars.version }} to {{ vars.environment }}"
  ci:                         # deps become task calls
    steps:
      - name: run_test
        task: test
      - name: run_build
        task: build

Run it

orchstep run build
orchstep run deploy --var environment=production --var version=2.1.0
$ orchstep run deploy --var environment=production --var version=2.1.0
  $ echo "deploying v2.1.0 to production"
deploying v2.1.0 to production
Result: success

Task's task deploy VERSION=2.1.0 ENVIRONMENT=prod becomes the explicit --var version=2.1.0 --var environment=prod. List everything with orchstep list-tasks.

Gotchas worth knowing

  • {{.VAR}} becomes {{ vars.VAR }}. This is the main change: Task roots its template at the dot, OrchStep namespaces values under vars.
  • deps: run in parallel by default. To keep that behavior, use a parallel: block; if you actually wanted ordering, use sequential task: steps (as shown in the ci task above).
  • Each cmds: entry is a step. A list of commands under cmds: becomes a list of named steps, so you get per-step status and --dry-run.
  • env is reserved. Don't name a variable env - that namespace is for environment variables ({{ env.PATH }}). Use environment (the loader will stop you with a clear error otherwise).

What you gain

  • orchstep run --dry-run previews the whole chain (including ci -> test/build).
  • Steps pass typed outputs instead of echoing strings.
  • Per-step status and ordering control instead of all-parallel deps:.
  • Shared tasks can become versioned modules.

Where to go next