markov

Getting Started

Get from zero to a running workflow in under 5 minutes.

Prerequisites

Installation

git clone https://github.com/jctanner/markov.git
cd markov
go build -o markov ./cmd/markov

Or use the pre-built binary in bin/markov.

Your First Workflow

Create a file called hello.yaml:

entrypoint: hello

vars:
  greeting: "hello from markov"

workflows:
  - name: hello
    steps:
      - name: say-hello
        type: shell_exec
        params:
          command: "echo '{{ greeting }}'"
        register: hello_result

      - name: show-date
        type: shell_exec
        params:
          command: "date +%Y-%m-%d"
        register: date_result

      - name: combine
        type: shell_exec
        params:
          command: "echo 'Message: {{ hello_result.stdout }} on {{ date_result.stdout }}'"

Validate It

markov validate hello.yaml
# Output: valid

Run It

markov run hello.yaml --verbose

You’ll see each step execute in order, with the --verbose flag showing parameter values and registered outputs.

Check the Result

markov status <run-id> --steps

This shows the status and duration of each step.

If a run fails, fix the cause and resume it from the same state store:

markov resume <run-id>

See Resuming Workflows for the full recovery workflow and caveats.

Override Variables

markov run hello.yaml --var greeting="hey there"

CLI --var flags override the values defined in the workflow file.

Try Fan-Out

Create fanout.yaml:

entrypoint: main

forks: 3

vars:
  items: ["alpha", "bravo", "charlie", "delta", "echo"]

workflows:
  - name: main
    steps:
      - name: process-items
        type: shell_exec
        for_each: "items"
        as: item
        params:
          command: "echo 'processing {{ item }}'"
        register: results

      - name: summary
        type: shell_exec
        params:
          command: "echo 'processed {{ results | length }} items'"
markov run fanout.yaml --verbose

Items process 3 at a time (controlled by forks: 3).

Try a Directory Workflow

Markov can also run a workflow directory. The directory splits the same workflow schema across required files:

examples/dir-based-hello-world/
  meta.yaml
  vars.yaml
  rules.yaml
  step_types.yaml
  workflows/
    main.yaml

Custom step types can also live in step_types/*.yaml files when you want to split them by category.

Validate and run it:

markov validate examples/dir-based-hello-world
markov run examples/dir-based-hello-world --verbose

What’s Next