Your First Workflow
A workflow is a YAML file with a list of steps. Each step runs a command, and depends says which steps must finish before it starts.
The workflow
bash
curl -fsSLO https://docs.dagu.sh/tutorial/dags/tutorial-01-first-workflow.yamlyaml
# Dagu tutorial, lesson 1: https://docs.dagu.sh/tutorial/first-workflow
description: Four steps; lint and test run in parallel
type: graph
steps:
- id: checkout
run: echo "Fetched the source code"
- id: lint
run: sleep 1 && echo "Lint passed"
depends: checkout
- id: test
run: sleep 2 && echo "12 tests passed"
depends: checkout
- id: package
run: echo "Packaged app.tar.gz"
depends: [lint, test]idnames a step. Other steps refer to it by this name.runis the shell command the step runs.dependslists the steps that must succeed first.lintandtestboth wait forcheckout, andpackagewaits for both of them.type: graphis the default. Steps that do not depend on each other run in parallel, solintandteststart together.
Watch it run
packagerunSucceeded
Packaged app.tar.gz
lint and test start at the same time. package starts only after the slower test finishes.
Run it yourself
bash
dagu start tutorial-01-first-workflow.yamlThe command prints each step with its status and output, then the result. To run it from the Web UI instead, open Workflows, select tutorial-01-first-workflow, and select Start.
Before running a workflow you just edited, check it without running anything:
bash
dagu validate tutorial-01-first-workflow.yamlTry it
- Make
testfail by changing its command toexit 1, then run the workflow again. What happens topackage? - Remove
depends: checkoutfromlint. When doeslintstart now?
Answers
- The run fails, and
packageends as Aborted without running. A step starts only when every step it depends on has succeeded. - Immediately, at the same time as
checkout. A step withoutdependshas nothing to wait for. To run every step in the order written, withoutdepends, settype: chaininstead oftype: graph.

