> For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt.

# A first pipeline

A pipeline lives in `.hod/pipeline.yaml` at the root of your project. The smallest one:

```yaml
version: 0
on: [push]
jobs:
  hello:
    image: alpine:3.22
    steps:
      - run: echo "hello from $HOD_JOB at $HOD_SHA"
```

Every job names the container image it runs in. There's no default "runner VM" with tools preinstalled: pick an image that has your toolchain (`node:22`, `golang:1.23`, `rust:1.90`, `python:3.13`). Steps run in order in one container, with `bash -eo pipefail` if the image has bash, else `sh -e`. The job starts in `/workspace`, which holds a copy of your project.

```sh
hod validate   # compile the pipeline and report every problem with file:line:col
hod plan       # what would run for a push to the current branch, and why
hod local run  # run it, in Docker
```

A pipeline for a Node project with tests, a build and a release step:

```yaml
version: 0

on:
  push:
    branches: [main]
    tags: ["v*"]
  pull_request: {}

vars:
  is_release: has(event.semver) && event.semver.prerelease == ""

jobs:
  test:
    if: changed("src/**", "test/**", "package.json", "package-lock.json")
    image: node:22
    cache: [npm]
    steps:
      - run: npm ci
      - run: npm test
        cache:
          inputs: [package-lock.json, src/, test/]

  build:
    needs: [test]
    image: node:22
    cache: [npm]
    env:
      NODE_ENV: production
    steps:
      - run: npm ci && npm run build
        files: [dist/]

  package:
    needs: [build]
    if: vars.is_release
    image: alpine:3.22
    steps:
      - name: tarball
        run: mkdir -p release && tar -czf "release/app-$VERSION.tar.gz" dist/
        env:
          VERSION: ${{ event.semver.version }}
        files: [release/]
```

What each part does:

- **`on`** starts runs for pushes to `main`, tags starting with `v`, and pull requests ([Events and conditions](https://docs.hod.sh/pipelines/events.md)).
- **`vars`** are named [CEL](https://cel.dev) expressions, computed once per run, and **`if`** decides whether a job or step runs. Every expression is type-checked when the pipeline compiles, so a typo is an error from `hod validate`, not a job that silently never runs.
- **`needs`** orders jobs: `build` runs after `test` succeeded. Jobs without `needs` between them run at the same time ([Jobs and steps](https://docs.hod.sh/pipelines/jobs.md)).
- **`files`** passes `dist/` to the jobs that need `build`. Nothing else passes between jobs but typed outputs: each job starts from a fresh copy of your project ([Files and outputs](https://docs.hod.sh/pipelines/files-and-outputs.md)).
- **`env`** sets variables. `${{ … }}` puts an expression's value into one; scripts never get expressions pasted into them, so a branch name can't inject shell code.
- **`cache: [npm]`** keeps npm's downloads between runs, and **`cache.inputs`** skips `npm test` when none of its inputs changed ([Caching](https://docs.hod.sh/pipelines/caching.md)).

Next: run it on your machine ([Running locally](https://docs.hod.sh/start/running.md)), then the Writing pipelines pages for each part, starting with [Events and conditions](https://docs.hod.sh/pipelines/events.md).
