> 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.

# Jobs and steps

`jobs:` maps names to jobs. A name starts with a letter or `_`, followed by letters, digits, `_` and `-`. Jobs run at the same time unless `needs:` orders them.

## Where a job runs

`image:` names a container image, as `docker pull` would. 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`). Jobs without one run in their runner's default image (`debian:12-slim` unless the runner sets another), or on the runner's machine for `runs-on: [macos]` and `[windows]`.

`runs-on:` lists labels a runner must all have. It can read `${{ matrix.* }}` and nothing else.

Steps run in order, in one container, with `bash -eo pipefail` if the image has bash, else `sh -e`. The job starts in `/workspace`, a copy of the repository at the run's commit, with `.git` read-only. A step's `dir:` runs it in a subdirectory, and `name:` is what logs and the UI show (the script's first line by default).

## Order

A job runs when every job in its `needs:` succeeded, and is skipped otherwise, unless its `if:` reads their results. In a job's `if:`, `jobs.<name>.result` is `"success"`, `"failure"`, `"cancelled"` or `"skipped"`, for the jobs in its `needs:` only.

```yaml
version: 0
on: [push]
jobs:
  test:
    image: alpine:3.22
    steps:
      - run: ./test.sh
  report:
    needs: [test]
    if: jobs.test.result == "failure"
    image: alpine:3.22
    steps:
      - run: echo "the tests failed"
```

A job that `needs:` another gets its files and reads its outputs ([Files and outputs](https://docs.hod.sh/pipelines/files-and-outputs.md)). A job name with `-` reads as `jobs["build-linux"]`.

## Variables

`env:` sets variables on a job (for every step) or on a step. `${{ … }}` is a CEL expression whose value is put into the string.

```yaml
version: 0
on: [push]
jobs:
  greet:
    image: alpine:3.22
    env:
      BRANCH: ${{ event.branch }}
    steps:
      - run: echo "building $BRANCH"
```

There is no `${{ }}` in `run:`. Values from the event reach scripts only through variables, never pasted into the script, so a branch name can't inject shell code. The variables Hod sets itself are in [Expressions and values](https://docs.hod.sh/reference/expressions.md#values-hod-gives-you).

## Docker in a job

`docker: true` gives the job a Docker daemon of its own, in a privileged container beside the job's, so steps can `docker build`, `docker run` and `docker compose up`. The job's image needs the `docker` CLI. On a server, only runners started with `--allow-docker` take these jobs.

## Pushing to the repository

`push:` on a step lets it push to refs that match its globs (full ref names, starting with `refs/`). Other steps can't push, pull request runs never can, and pushes made by Hod don't start runs. `.git` is read-only, so push a commit to a new ref rather than making it locally:

```yaml
version: 0
on:
  push:
    branches: [main]
jobs:
  tag:
    image: alpine/git:2.47.2
    steps:
      - run: git push origin "HEAD:refs/tags/v$(cat VERSION)"
        push: ["refs/tags/v*"]
```
