vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Restructure documentation around reader tasks
348a43c364fbb04be834af44a7cd43a0931fa280 · Keenan Nemetz · 20d ago · parent b7383c19
Restructure documentation around reader tasks Group the site by getting started, collaboration, CI, publishing, and administration. Rewrite the guides as executable procedures and move issue formats, merge semantics, configuration defaults, customization, and access-control mechanics into dedicated references. Verify the quickstart and review flow against a throwaway instance, execute the service recipe, inspect the rendered site, and run the complete verify workflow. Closes: 01M7B6X6RDYBAP3JVA5SYSA1K8
docs/workflows.md +221−424
| @@ -1,105 +1,109 @@ | |||
| 1 | 1 | # Workflows | |
| 2 | 2 | ||
| 3 | A workflow describes what CI runs: which pushes, change requests, issues, | ||
| 4 | comments, schedules, or manual runs trigger it, which steps each job executes, and | ||
| 5 | what it publishes. Machines and execution belong to [runners](runner.md); this page | ||
| 6 | is about the repository side. | ||
| 3 | A workflow tells Vole when to run jobs and which container steps each job | ||
| 4 | executes. Store workflows in `.vole/workflows/*.yaml`; Vole validates them before | ||
| 5 | accepting a push. | ||
| 7 | 6 | ||
| 8 | For every field, limit, and default, see the [Workflow reference](reference/workflow-reference.md), | ||
| 9 | including [what a workflow cannot express](reference/workflow-reference.md#what-a-workflow-cannot-express). | ||
| 7 | Use this guide to add and operate CI. The | ||
| 8 | [workflow reference](reference/workflow-reference.md) owns every field, default, | ||
| 9 | limit, and validation rule. | ||
| 10 | 10 | ||
| 11 | ## Add a workflow | ||
| 11 | ## Add your first workflow | ||
| 12 | 12 | ||
| 13 | Workflows live in `.vole/workflows/*.yaml`. When you push a new workflow, Vole | ||
| 14 | checks it before accepting the push, so a broken workflow is rejected early. | ||
| 13 | Start from a repository clone. To run the workflow locally, you also need Docker, | ||
| 14 | rootless Podman, or nerdctl. | ||
| 15 | 15 | ||
| 16 | ```yaml | ||
| 17 | version: 1 | ||
| 18 | name: Verify main | ||
| 19 | description: Build, test and lint every push to main. | ||
| 20 | on: | ||
| 21 | push: | ||
| 22 | branches: [main] | ||
| 23 | jobs: | ||
| 24 | build: | ||
| 25 | name: Build and test | ||
| 26 | runs-on: [linux, arm64] # only a runner with both labels takes this job | ||
| 27 | image: golang:1.27-bookworm | ||
| 28 | steps: | ||
| 29 | - name: test | ||
| 30 | run: go test ./... | ||
| 31 | - name: build | ||
| 32 | run: make dist | ||
| 33 | artifacts: | ||
| 34 | - path: dist/* | ||
| 35 | pages: | ||
| 36 | path: site/ # publish this directory as the repository's site | ||
| 37 | ``` | ||
| 16 | 1. Create `.vole/workflows/verify.yaml`: | ||
| 17 | |||
| 18 | ```yaml | ||
| 19 | version: 1 | ||
| 20 | name: Verify | ||
| 21 | on: | ||
| 22 | push: | ||
| 23 | branches: [main] | ||
| 24 | jobs: | ||
| 25 | test: | ||
| 26 | runs-on: [linux] | ||
| 27 | image: golang:1.27-bookworm | ||
| 28 | network: bridge | ||
| 29 | steps: | ||
| 30 | - name: test | ||
| 31 | run: go test ./... | ||
| 32 | ``` | ||
| 33 | |||
| 34 | `network: bridge` lets the job download Go modules. A job without it receives | ||
| 35 | the network its runner offers, which is none by default. `runs-on` is | ||
| 36 | optional; when present, a runner must have every listed label. | ||
| 37 | |||
| 38 | 2. Validate the file and inspect its triggers: | ||
| 39 | |||
| 40 | ```sh | ||
| 41 | vole workflow check | ||
| 42 | vole workflow list | ||
| 43 | ``` | ||
| 38 | 44 | ||
| 39 | `name` and `description` say what the workflow is for; the file path stays its | ||
| 40 | identity. When `name` is absent, a run shows the file's base name (`verify.yaml` | ||
| 41 | becomes `verify`). A job's `name` is shown in place of its ID on the run page. | ||
| 42 | These fields are display metadata: they do not change what runs, and two | ||
| 43 | workflows may share a name. | ||
| 45 | For one valid workflow, the check prints: | ||
| 44 | 46 | ||
| 45 | Every job must name the environment it runs in, with exactly one of `image:` or | ||
| 46 | `image-file:`. A workflow that names neither fails the push that introduced it. | ||
| 47 | See [Images](#images) for the two forms. | ||
| 47 | ```text | ||
| 48 | ok: 1 workflow(s) | ||
| 49 | ``` | ||
| 48 | 50 | ||
| 49 | Triggers work like this: | ||
| 51 | 3. Run the job against your working tree: | ||
| 50 | 52 | ||
| 51 | - `on.push.branches` limits a workflow to certain branches; a leading `!` excludes | ||
| 52 | what an earlier pattern included. | ||
| 53 | - `on.push.tags` limits it to tag pushes. | ||
| 54 | - `on.push.paths` and `on.push.paths-ignore` filter a push by the files it changes. | ||
| 55 | - A workflow with no `on` trigger at all runs on every branch. | ||
| 56 | - A workflow that names `tags:` runs only on tags. | ||
| 57 | - A workflow that declares only event triggers does not also run on every push. | ||
| 53 | ```sh | ||
| 54 | vole workflow run verify -j test | ||
| 55 | ``` | ||
| 58 | 56 | ||
| 59 | A push queues each job in the workflow as its own run. Jobs are independent and | ||
| 60 | unordered in CI: one job cannot wait for another, read its files, or consume its | ||
| 61 | result. The order in the file matters only to a local `vole workflow run`, which | ||
| 62 | executes the selected jobs in that order. | ||
| 57 | Vole executes the steps in the named image, not directly on your machine. It | ||
| 58 | mounts your uncommitted files, stops at the first failure, and returns that | ||
| 59 | step's exit status. Use `--container-runtime podman` to select Podman instead | ||
| 60 | of the default Docker. | ||
| 63 | 61 | ||
| 64 | `runs-on` asks for a runner with every label in the list. A job with no `runs-on` | ||
| 65 | can run anywhere. See [Runners § Start a runner](runner.md#start-a-runner) for what the | ||
| 66 | labels mean on the machine. | ||
| 62 | Local runs ignore triggers and `runs-on`, and do not publish artifacts or | ||
| 63 | sites. Jobs run in declaration order and share the working tree; pushed jobs | ||
| 64 | are independent and start from clean checkouts. See | ||
| 65 | [Local execution differences](reference/workflow-reference.md#validation-and-pinning) | ||
| 66 | and [Run a job locally](#run-a-job-locally). | ||
| 67 | 67 | ||
| 68 | A job can budget its whole run instead of each step separately. `timeout:` on a job | ||
| 69 | is the clock its steps share, so one long step is one number to write: | ||
| 68 | 4. Commit and push the workflow. Vole validates it again in pre-receive, queues | ||
| 69 | matching jobs, and records each job as a separate run. | ||
| 70 | |||
| 71 | ## Run a job locally | ||
| 72 | |||
| 73 | Select all workflows, one workflow, or one job: | ||
| 74 | |||
| 75 | ```sh | ||
| 76 | vole workflow run | ||
| 77 | vole workflow run verify | ||
| 78 | vole workflow run verify -j test | ||
| 79 | vole workflow run -j test | ||
| 80 | ``` | ||
| 81 | |||
| 82 | A local run uses the same image build, job timeout, service, secret, and cache | ||
| 83 | behavior as a runner. Its default network capability is `bridge`; use | ||
| 84 | `--container-network none` to reproduce a runner with no network. | ||
| 85 | |||
| 86 | The runner mounts a reusable cache at `/cache` but does not choose which tools | ||
| 87 | use it. Set tool-specific environment variables in the image or job: | ||
| 70 | 88 | ||
| 71 | 89 | ```yaml | |
| 72 | 90 | jobs: | |
| 73 | 91 | test: | |
| 74 | 92 | image: golang:1.27-bookworm | |
| 75 | timeout: 2h | ||
| 93 | env: | ||
| 94 | GOCACHE: /cache/go-build | ||
| 95 | GOMODCACHE: /cache/go-mod | ||
| 76 | 96 | steps: | |
| 77 | 97 | - run: go test ./... | |
| 78 | 98 | ``` | |
| 79 | 99 | ||
| 80 | A step with no timeout of its own runs with what is left of the budget, and a budget | ||
| 81 | that runs out stops the job at the next step. Without the field, each step keeps its | ||
| 82 | own cap and the job has no total. See | ||
| 83 | [Workflow reference § timeout](reference/workflow-reference.md#timeout), which | ||
| 84 | also says why the image build is not part of the budget. | ||
| 85 | |||
| 86 | A job's network is closed by default: the container gets whatever the runner can | ||
| 87 | offer, and a runner with no network is the normal case. `network: bridge` asks for | ||
| 88 | one, which a job that downloads dependencies needs, and only a runner that can | ||
| 89 | provide it takes the job. `network: none` withholds it, so a job that should not | ||
| 90 | reach out fails to resolve a host instead of quietly succeeding, even on a machine | ||
| 91 | that could have given it a network. Declaring the field makes the job behave the | ||
| 92 | same way everywhere instead of depending on which runner picked it up. See | ||
| 93 | [Workflow reference § network](reference/workflow-reference.md#network). | ||
| 100 | Use `--no-cache` to empty the cache after each job or `--cache-size` to cap it. | ||
| 101 | [Caching](runner.md#caching) explains namespaces and eviction. | ||
| 94 | 102 | ||
| 95 | When a push starts a job, Vole remembers the exact commit, the exact workflow | ||
| 96 | file, and the exact image definition. Editing any of them later does not change a | ||
| 97 | job that is already queued. | ||
| 103 | ## React to repository events | ||
| 98 | 104 | ||
| 99 | ## Triggers beyond a push | ||
| 100 | |||
| 101 | A workflow can react to a change request, an issue, a comment, a schedule, or a | ||
| 102 | maintainer asking for a run: | ||
| 105 | The `on:` field selects pushes, tags, changed paths, collaboration events, | ||
| 106 | schedules, or manual runs: | ||
| 103 | 107 | ||
| 104 | 108 | ```yaml | |
| 105 | 109 | version: 1 | |
| @@ -125,34 +129,26 @@ jobs: | |||
| 125 | 129 | - run: jq . "$VOLE_EVENT_PATH" | |
| 126 | 130 | ``` | |
| 127 | 131 | ||
| 128 | A change-request run checks out the request's base branch tip, not the proposed | ||
| 129 | head. The head and the changed files are in the event payload, so a workflow can | ||
| 130 | report on a change without executing an unapproved contributor commit. | ||
| 131 | |||
| 132 | An issue, comment, or schedule run uses the default branch tip. A manual run uses | ||
| 133 | the branch chosen in the browser or with `--ref`. | ||
| 132 | For non-push events, Vole writes the event to `/run/vole/event.json` and sets | ||
| 133 | `VOLE_EVENT`, `VOLE_EVENT_ACTION`, and `VOLE_EVENT_PATH`. Read the file as data; | ||
| 134 | do not interpolate issue or comment text into a shell command. | ||
| 134 | 135 | ||
| 135 | The event is a JSON file. The runner sets `VOLE_EVENT`, `VOLE_EVENT_ACTION`, and | ||
| 136 | `VOLE_EVENT_PATH` (`/run/vole/event.json`) for every non-push trigger. Read it as | ||
| 137 | data; do not interpolate it into a shell command. See | ||
| 138 | [Workflow reference § Event data available to steps](reference/workflow-reference.md#event-data-available-to-steps) | ||
| 139 | for the fields. | ||
| 136 | A change-request event checks out the base branch, not the unapproved head. | ||
| 137 | Issue, comment, and schedule events use the default branch. A manual run uses | ||
| 138 | its selected `--ref`. See | ||
| 139 | [Event data available to steps](reference/workflow-reference.md#event-data-available-to-steps) | ||
| 140 | for the payload fields. | ||
| 140 | 141 | ||
| 141 | A workflow is not a template. There is no `${{ }}` and no substitution inside | ||
| 142 | `run`: use `env` or a declared secret for a configuration value, and read the | ||
| 143 | event file when a step needs something the event carries. The event is text | ||
| 144 | someone else wrote, so it stays data instead of becoming part of a command. See | ||
| 145 | [Workflow reference § Context and expressions](reference/workflow-reference.md#context-and-expressions) | ||
| 146 | for the reasoning and an input example. | ||
| 142 | Workflows do not support `${{ }}` expressions or substitution inside `run`. | ||
| 143 | Declare environment variables, inputs, and secrets explicitly. The | ||
| 144 | [context and expressions reference](reference/workflow-reference.md#context-and-expressions) | ||
| 145 | explains the constraint. | ||
| 147 | 146 | ||
| 148 | ## Filtering an event | ||
| 147 | ### Filter automation by author | ||
| 149 | 148 | ||
| 150 | A trigger can narrow an event to the cases a job cares about. This is how a coding | ||
| 151 | agent can wait to be asked, instead of running on every comment: | ||
| 149 | Event filters can restrict a coding agent to maintainer requests: | ||
| 152 | 150 | ||
| 153 | 151 | ```yaml | |
| 154 | version: 1 | ||
| 155 | name: Coding agent | ||
| 156 | 152 | on: | |
| 157 | 153 | issue: | |
| 158 | 154 | types: [opened, assigned] | |
| @@ -165,89 +161,35 @@ on: | |||
| 165 | 161 | replied-to: [coding-agent] | |
| 166 | 162 | author: | |
| 167 | 163 | role: maintain | |
| 168 | jobs: | ||
| 169 | agent: | ||
| 170 | image-file: agent | ||
| 171 | network: bridge | ||
| 172 | timeout: 2h | ||
| 173 | acts-as: coding-agent | ||
| 174 | steps: | ||
| 175 | - run: run-the-session | ||
| 176 | ``` | ||
| 177 | |||
| 178 | `mentioned` matches an `@coding-agent` in the issue, comment, or change body. | ||
| 179 | `replied-to` matches a comment that answers one written by `coding-agent`. | ||
| 180 | `assigned-to` matches an issue that was assigned to it, including one opened with | ||
| 181 | that assignment already set. `author.role: maintain` is the ACL filter: it admits | ||
| 182 | maintainers and admins, not contributors or readers. Use `author.name` instead when the | ||
| 183 | rule is a list of people rather than a capability. | ||
| 184 | |||
| 185 | A comment is not treated as addressed to its own author, so the agent's reply does | ||
| 186 | not start it again. Mentions inside code samples are ignored. See | ||
| 187 | [Workflow reference § Event filters](reference/workflow-reference.md#event-filters) | ||
| 188 | for the exact rules. | ||
| 189 | |||
| 190 | The job acts as an account, so the account it uses should be a bot: it has no | ||
| 191 | browser sign-in and is shown as a bot wherever its name appears. `acts-as:` names it, and | ||
| 192 | the instance gives the job a credential for that account when it is leased — one | ||
| 193 | run's key, written into the job, gone when the run ends — so a comment or a change it | ||
| 194 | writes is attributable and needs no long-lived key in a repository secret. The | ||
| 195 | account's role still decides what it may do. See | ||
| 196 | [Accounts and access § Bot accounts](accounts-and-access.md#bot-accounts) and | ||
| 197 | [Workflow reference § acts-as](reference/workflow-reference.md#acts-as). | ||
| 198 | |||
| 199 | `network: bridge` is there because the session calls a model; `timeout` because a | ||
| 200 | session can run longer than the ten-minute step default. A job that runs unattended | ||
| 201 | should have both. | ||
| 202 | |||
| 203 | A comment body is still untrusted text. If the job can write — comment, push a | ||
| 204 | branch, or open a change — use `author.role: maintain` or `author.name` to limit who | ||
| 205 | can start it. Assignment is not a substitute for that filter: whoever opened an | ||
| 206 | issue may assign it, so `assigned-to` alone lets a contributor whose issue it is | ||
| 207 | start the job. Combine the two when only a maintainer should be able to ask. Read | ||
| 208 | the agent's instructions from the repository, never from the event body. | ||
| 209 | |||
| 210 | ## Manual runs | ||
| 211 | |||
| 212 | A workflow with `on.workflow-dispatch` can be started by hand. Maintainers and | ||
| 213 | instance admins can start one from a clone: | ||
| 214 | |||
| 215 | ```sh | ||
| 216 | vole workflow dispatch --workflow .vole/workflows/deploy.yaml \ | ||
| 217 | --ref main --input environment=production | ||
| 218 | 164 | ``` | |
| 219 | 165 | ||
| 220 | The selected branch must exist, and each input is resolved against the types and | ||
| 221 | defaults the workflow declares before anything is queued. | ||
| 222 | |||
| 223 | ## Combined results | ||
| 166 | `author.role: maintain` admits maintainers and admins. Use `author.name` for a | ||
| 167 | list of specific accounts. Assignment alone is not an authorization boundary | ||
| 168 | because the issue author can assign their own issue. Mentions in code samples do | ||
| 169 | not match. [Event filters](reference/workflow-reference.md#event-filters) defines | ||
| 170 | all filter combinations. | ||
| 224 | 171 | ||
| 225 | A change request that cannot fast-forward needs a merge commit before it can land. | ||
| 226 | Vole builds that merge and runs the jobs that apply to the base branch against it, | ||
| 227 | so the tree that lands is the tree that was tested. The run is queued automatically | ||
| 228 | when the head is pushed, and again when the base moves for a request that is under | ||
| 229 | review or waiting to merge. It uses the workflow files at the merge, so a workflow | ||
| 230 | change on the base applies to the landing, and it does not deploy the repository's | ||
| 231 | site. | ||
| 232 | |||
| 233 | A combined result derived from a contributor branch is untrusted code. It runs only | ||
| 234 | after a maintainer allowed that exact head, and it uses the contributor's cache | ||
| 235 | namespace rather than the one a protected branch builds into. | ||
| 172 | A job with `acts-as: coding-agent` receives a per-run credential for that bot. | ||
| 173 | The credential has the bot's repository role and expires with the run. See | ||
| 174 | [Bot accounts](accounts-and-access.md#bot-accounts) and | ||
| 175 | [`acts-as`](reference/workflow-reference.md#acts-as). | ||
| 236 | 176 | ||
| 237 | 177 | ## Images | |
| 238 | 178 | ||
| 239 | A job can name a registry image directly: | ||
| 179 | Each job uses exactly one registry `image:` or repository `image-file:`. Pin a | ||
| 180 | registry image by digest when the build must be reproducible: | ||
| 240 | 181 | ||
| 241 | 182 | ```yaml | |
| 242 | 183 | jobs: | |
| 243 | 184 | build: | |
| 244 | image: golang:1.27-bookworm@sha256:... | ||
| 185 | image: golang:1.27-bookworm@sha256:<digest> | ||
| 186 | steps: | ||
| 187 | - run: go test ./... | ||
| 245 | 188 | ``` | |
| 246 | 189 | ||
| 247 | Or keep a reusable definition under `.vole/images/` and reference it by name: | ||
| 190 | For a reusable toolchain, define `.vole/images/go.yaml`: | ||
| 248 | 191 | ||
| 249 | 192 | ```yaml | |
| 250 | # .vole/images/go.yaml | ||
| 251 | 193 | version: 1 | |
| 252 | 194 | from: golang:1.27-bookworm | |
| 253 | 195 | env: | |
| @@ -256,6 +198,8 @@ run: | |||
| 256 | 198 | - apt-get update && apt-get install -y --no-install-recommends jq | |
| 257 | 199 | ``` | |
| 258 | 200 | ||
| 201 | Reference it by base name: | ||
| 202 | |||
| 259 | 203 | ```yaml | |
| 260 | 204 | jobs: | |
| 261 | 205 | build: | |
| @@ -264,52 +208,22 @@ jobs: | |||
| 264 | 208 | - run: go test ./... | |
| 265 | 209 | ``` | |
| 266 | 210 | ||
| 267 | `image-file: go` resolves `.vole/images/go.yaml`, which needs `version: 1`, a | ||
| 268 | base `from`, and optionally `env` and `run`. The [Image | ||
| 269 | reference](reference/image-reference.md) has the whole schema, the limits, and a | ||
| 270 | complete example. | ||
| 271 | |||
| 272 | A definition is validated when the workflow is pushed, including definitions that | ||
| 273 | are not referenced, and it is pinned with the run. The runner builds the image | ||
| 274 | locally and tags it by the definition digest, so later jobs with the same | ||
| 275 | definition reuse the build. See [Runners § Images](runner.md#images-and-image-builds) | ||
| 276 | for the execution, caching, and security details, including why a definition that | ||
| 277 | changes on a contributor branch is a build worth reviewing. | ||
| 278 | |||
| 279 | The image is the dependency manifest. It should contain the toolchains and system | ||
| 280 | packages the builds need, plus `/bin/sh` and a POSIX `sleep` (Vole runs shell steps | ||
| 281 | and keeps the container alive between them). Pin the base image by digest; a | ||
| 282 | mutable tag changes what a build means. | ||
| 283 | |||
| 284 | ## Environment | ||
| 285 | |||
| 286 | `env` on a job applies to every step, after the image's own, so the job wins: | ||
| 287 | |||
| 288 | ```yaml | ||
| 289 | jobs: | ||
| 290 | test: | ||
| 291 | image: golang:1.27-bookworm | ||
| 292 | env: | ||
| 293 | GOCACHE: /cache/go-build | ||
| 294 | steps: | ||
| 295 | - run: go test ./... | ||
| 296 | ``` | ||
| 297 | |||
| 298 | The runner sets `CI=true`, `VOLE_CI=1`, `HOME=/tmp`, `TMPDIR=/tmp`, and | ||
| 299 | `GIT_TERMINAL_PROMPT=0`; a workflow that tries to replace one of those is refused at | ||
| 300 | push time. Everything else is the workflow's. This is how a job opts in to the | ||
| 301 | cache the runner mounts at `/cache`, and how a job using a registry image gets it | ||
| 302 | without an image definition. | ||
| 211 | Vole pins the definition with the queued run. The runner builds it locally and | ||
| 212 | caches it by digest. Image build commands execute repository code, so review | ||
| 213 | changes to definitions with the same care as workflow steps. See the | ||
| 214 | [image reference](reference/image-reference.md) and | ||
| 215 | [runner image builds](runner.md#images-and-image-builds). | ||
| 303 | 216 | ||
| 304 | ## Services | ||
| 217 | ## Network and services | ||
| 305 | 218 | ||
| 306 | A job can start a database, a queue, or another server beside it and reach it by | ||
| 307 | name. The job has to ask for a network too, because the service is reached over it: | ||
| 219 | A job can explicitly request `network: bridge` or `network: none`. A runner must | ||
| 220 | offer bridge networking to lease a bridge job. Services also require bridge | ||
| 221 | networking: | ||
| 308 | 222 | ||
| 309 | 223 | ```yaml | |
| 310 | 224 | jobs: | |
| 311 | test: | ||
| 312 | image: golang:1.27-bookworm | ||
| 225 | check-database: | ||
| 226 | image: postgres:17 | ||
| 313 | 227 | network: bridge | |
| 314 | 228 | services: | |
| 315 | 229 | db: | |
| @@ -319,278 +233,161 @@ jobs: | |||
| 319 | 233 | PGDATA: /tmp/pgdata | |
| 320 | 234 | steps: | |
| 321 | 235 | - run: | | |
| 322 | DATABASE_URL=postgres://postgres:test@db:5432/postgres go test ./... | ||
| 236 | until pg_isready -h db -U postgres -d postgres; do sleep 1; done | ||
| 237 | psql postgres://postgres:test@db:5432/postgres -c 'select 1' | ||
| 323 | 238 | ``` | |
| 324 | 239 | ||
| 325 | The service's name is its hostname on a private network the runner creates for the | ||
| 326 | attempt. The job and its services are the only members, so `db:5432` is the address | ||
| 327 | a step uses. The service is a container, not a job: it has no steps, no checkout, | ||
| 328 | no secrets, and no files from the runner. At most three may run beside one job. | ||
| 329 | |||
| 330 | The runner starts them after the image is ready and before the first step. A service | ||
| 331 | that exits before the steps start fails the job. There is no health check, so a step | ||
| 332 | that needs a server to accept connections waits for it, as a postgres test waits with | ||
| 333 | `pg_isready`. When the job fails, times out, or is canceled, the end of each | ||
| 334 | service's output is added to the log under `=== service db ===`; a passing run drops | ||
| 335 | it. The job, the services, and the network are removed together, and a killed | ||
| 336 | runner's leftovers are cleaned up by its next start. | ||
| 337 | |||
| 338 | A service image must run as the job's uid, and `/tmp` is writable. The postgres | ||
| 339 | example points `PGDATA` at `/tmp` for that reason. A database image that insists on | ||
| 340 | starting as root does not work here; use one that can run unprivileged or publish a | ||
| 341 | custom image. The runner's memory, CPU, and PID flags apply to each container, so a | ||
| 342 | job with services can use more than one container's share. | ||
| 240 | The service name is its hostname on a private network for that attempt. Services | ||
| 241 | have no checkout, cache, or secrets. Vole does not perform health checks, so the | ||
| 242 | first step must wait until the service accepts connections. | ||
| 243 | |||
| 244 | Service containers run as the job's unprivileged user; point writable data such | ||
| 245 | as `PGDATA` at `/tmp`. See [`services`](reference/workflow-reference.md#services) | ||
| 246 | for limits and lifecycle. | ||
| 343 | 247 | ||
| 344 | 248 | ## Secrets | |
| 345 | 249 | ||
| 346 | A repository can keep the values its jobs need out of its code: a deploy key, a | ||
| 347 | registry token, a staging password. They are stored encrypted on the instance and | ||
| 348 | set by the people who maintain the repository: | ||
| 250 | Maintainers store repository secrets on the instance: | ||
| 349 | 251 | ||
| 350 | 252 | ```sh | |
| 351 | vole secret set demo DEPLOY_TOKEN # the value is read from stdin | ||
| 253 | vole secret set demo DEPLOY_TOKEN | ||
| 352 | 254 | vole secret list demo | |
| 353 | 255 | ``` | |
| 354 | 256 | ||
| 355 | A job asks for one by name, and the name is also the variable a step reads: | ||
| 257 | `secret set` reads the value from standard input. A job receives only the names | ||
| 258 | it declares: | ||
| 356 | 259 | ||
| 357 | 260 | ```yaml | |
| 358 | 261 | jobs: | |
| 359 | 262 | deploy: | |
| 360 | 263 | image: alpine:3.22 | |
| 361 | 264 | secrets: [DEPLOY_TOKEN] | |
| 362 | steps: | ||
| 363 | - run: ./deploy.sh # reads $DEPLOY_TOKEN | ||
| 364 | ``` | ||
| 365 | |||
| 366 | Declaring the name is what makes it present. A job that does not list a secret | ||
| 367 | does not receive it, so a repository's values are never ambient in its steps. | ||
| 368 | |||
| 369 | A name the repository has no value for does not fail the job: the variable is left | ||
| 370 | **unset**, not empty, and the log says which one it went without. | ||
| 371 | |||
| 372 | ``` | ||
| 373 | vole: DEPLOY_TOKEN is not set for this repository, so this job runs without it. | ||
| 374 | ``` | ||
| 375 | |||
| 376 | That is what makes an optional secret optional. When one is required, the step says | ||
| 377 | so, and the reader gets the message its author wrote: | ||
| 378 | |||
| 379 | ```yaml | ||
| 380 | 265 | steps: | |
| 381 | 266 | - run: | | |
| 382 | 267 | : "${DEPLOY_TOKEN:?DEPLOY_TOKEN is not set}" | |
| 383 | 268 | ./deploy.sh | |
| 384 | 269 | ``` | |
| 385 | 270 | ||
| 386 | A value is never copied into the workflow, into a container argument, or into a run | ||
| 387 | record: the record names the version of each value the job ran with, so a result | ||
| 388 | says which one it used. Values reach a step only as environment variables, and one | ||
| 389 | is at most 128 KiB, which is as much as one environment variable can carry. | ||
| 390 | |||
| 391 | A value is also replaced with `***` in the log as it is written, including one a | ||
| 392 | step prints by accident. That is best effort: a re-encoded value is not caught, a | ||
| 393 | value under four bytes is left alone, and an artifact or a site file is published | ||
| 394 | exactly as the step wrote it. See | ||
| 395 | [Workflow reference § secrets](reference/workflow-reference.md#secrets). | ||
| 396 | |||
| 397 | Anybody who can run a runner for a repository can read the values its jobs declare, | ||
| 398 | because that is the machine they arrive on. Secrets belong to the accounts that | ||
| 399 | approve work and allow CI, and the Secrets tab of the settings page that lists | ||
| 400 | them never shows one. | ||
| 401 | See [Accounts and access](accounts-and-access.md#roles). | ||
| 402 | |||
| 403 | ## Contributor branches | ||
| 404 | |||
| 405 | A push to `refs/heads/contrib/<name>/...` queues no work by itself. Those | ||
| 406 | branches contain code from outside the repository's maintainer group, and running | ||
| 407 | a workflow executes it on a runner. CI is held until a maintainer or admin opens the | ||
| 408 | change request for the branch and chooses **Allow CI** there. | ||
| 409 | |||
| 410 | The approval is keyed by the exact commit, not by the branch. A new commit or a | ||
| 411 | force-push is a new decision, so the contributor cannot push once and inherit | ||
| 412 | approval forever. The approval is stored in the CI queue database, so a | ||
| 413 | reconciliation or a temporary queue outage does not silently run an unapproved | ||
| 414 | tip. | ||
| 271 | A missing value leaves the variable unset and adds a note to the log. The shell | ||
| 272 | check above makes it required instead. Vole masks delivered values in logs, but | ||
| 273 | not transformed values or files published as artifacts and sites. | ||
| 415 | 274 | ||
| 416 | Allowing CI queues every workflow that applies to the branch. Workflows with no | ||
| 417 | `on.push.branches` filter run on every branch, including names with slashes such | ||
| 418 | as contributor branches. | ||
| 419 | |||
| 420 | ## Check and run a workflow locally | ||
| 421 | |||
| 422 | You can check workflows before pushing: | ||
| 423 | |||
| 424 | ```sh | ||
| 425 | vole workflow check | ||
| 426 | vole workflow list | ||
| 427 | ``` | ||
| 428 | |||
| 429 | You can also run the steps without a server or a runner. From the repository root: | ||
| 430 | |||
| 431 | ```sh | ||
| 432 | vole workflow run # every job in every workflow | ||
| 433 | vole workflow run build # every job in build.yaml | ||
| 434 | vole workflow run build -j test # one job in one workflow | ||
| 435 | vole workflow run -j test # the job named test in every workflow | ||
| 436 | ``` | ||
| 437 | |||
| 438 | A workflow can be named with or without its extension (`verify` or `verify.yaml`). The | ||
| 439 | command validates the workflow first, with the same checker a push uses, then | ||
| 440 | stops at the first failure and exits with that step's status, so it can wrap a | ||
| 441 | script. | ||
| 442 | |||
| 443 | The steps run in the image the job names, not on your machine. That is the point: | ||
| 444 | the answer here is the answer CI gives, so a toolchain difference between "works | ||
| 445 | for me" and a red run does not exist. An `image-file:` definition is built and | ||
| 446 | cached by digest exactly as a runner would build it, and the working tree is bound | ||
| 447 | into the container, so the steps see your uncommitted edits and leave their output | ||
| 448 | where you would expect. | ||
| 449 | |||
| 450 | The run needs a container runtime — Docker, rootless Podman, or nerdctl — and | ||
| 451 | `--container-runtime` selects one (Docker by default). There is no mode that skips | ||
| 452 | the container: a step that runs in a different environment proves nothing about | ||
| 453 | CI. The default network is `bridge`, because a job that cannot fetch a dependency | ||
| 454 | cannot run here either; `--container-network none` matches what a runner does by | ||
| 455 | default. The container runs as your uid and gid; its filesystem is writable but | ||
| 456 | thrown away when the run ends, and `/tmp` is a tmpfs. | ||
| 457 | |||
| 458 | A local run mounts the same job cache as a runner, under the user cache directory | ||
| 459 | (`$XDG_CACHE_HOME/vole/workflows`, usually `~/.cache/vole/workflows`), so a | ||
| 460 | repeated run is as fast here as it is on a runner. As on a runner, the run sets no | ||
| 461 | variables: the image's `env:` (or the step) decides whether `/cache` is used. See | ||
| 462 | [Runners § Caching](runner.md#caching). `--cache-size` caps it (5G by default) and | ||
| 463 | `--no-cache` empties it after every job. | ||
| 464 | |||
| 465 | A local run still ignores triggers and `runs-on`, publishes no artifacts, | ||
| 466 | and deploys no site. It does apply the job's `network:` request, so a `bridge` job | ||
| 467 | needs `--container-network bridge` here too (the default), and it starts the job's | ||
| 468 | services on the same kind of private network a runner would. It spends the job's | ||
| 469 | `timeout:` the way a runner does. It sets `CI=true` and `VOLE_CI=1`, gives each step | ||
| 470 | whatever the job's budget and its own timeout leave it, and reads no standard input. | ||
| 471 | It reads the secrets its jobs declare from the instance the checkout's remote names, | ||
| 472 | with your own credential, so a job that deploys behaves the same here as it does on | ||
| 473 | a runner. Where it cannot — no remote, or no value stored — the variable is unset | ||
| 474 | and the note says which one. Jobs run in declaration order and share the working | ||
| 475 | tree, so a later job sees files an earlier one wrote; a pushed run queues each job | ||
| 476 | separately, starts it from a clean checkout, and has no ordering between jobs. A | ||
| 477 | local run is not an event, so it sets no `VOLE_EVENT*` variables and has no event | ||
| 478 | payload. | ||
| 275 | Anyone controlling a trusted runner can read secrets declared by its jobs. Allow | ||
| 276 | CI only for code you would trust with those values. See | ||
| 277 | [`secrets`](reference/workflow-reference.md#secrets) and | ||
| 278 | [runner trust](runner.md#the-runners-account). | ||
| 479 | 279 | ||
| 480 | 280 | ## Artifacts | |
| 481 | 281 | ||
| 482 | Use `artifacts:` to list files that a build should publish. Vole expands the | ||
| 483 | patterns in the checkout after the steps pass, then uploads the files to the same | ||
| 484 | storage used by LFS and CI artifacts. | ||
| 282 | Declare files to upload after all steps pass: | ||
| 485 | 283 | ||
| 486 | 284 | ```yaml | |
| 487 | artifacts: | ||
| 488 | - path: dist/* | ||
| 489 | ``` | ||
| 490 | |||
| 491 | Artifacts appear on the run page with a download link: | ||
| 492 | |||
| 493 | ```sh | ||
| 494 | curl -OJ http://host/demo/runs/01M5.../artifacts/tool-linux | ||
| 495 | sha256sum tool-linux | ||
| 285 | jobs: | ||
| 286 | build: | ||
| 287 | image: golang:1.27-bookworm | ||
| 288 | steps: | ||
| 289 | - run: make dist | ||
| 290 | artifacts: | ||
| 291 | - path: dist/* | ||
| 496 | 292 | ``` | |
| 497 | 293 | ||
| 498 | A pattern that matches nothing fails the job. A build that stopped producing the | ||
| 499 | declared file is exactly what the declaration is meant to catch. If two matches | ||
| 500 | have the same base name, Vole refuses them so nothing is published under an | ||
| 501 | unexpected name. | ||
| 502 | |||
| 503 | A run artifact belongs to its run. It is not a release artifact. Moving one into a | ||
| 504 | release is a separate step (`vole release attach`). Run artifacts are kept for as | ||
| 505 | long as the run exists. | ||
| 294 | A pattern that matches nothing fails the job. Vole also rejects duplicate base | ||
| 295 | names. Run artifacts remain attached to their run and are separate from release | ||
| 296 | artifacts. See [`artifacts`](reference/workflow-reference.md#artifacts). | ||
| 506 | 297 | ||
| 507 | 298 | ## Build a release | |
| 508 | 299 | ||
| 509 | A tag push can build a release. Mark the artifacts `release: true`: | ||
| 300 | On an annotated tag workflow, mark artifacts with `release: true`: | ||
| 510 | 301 | ||
| 511 | 302 | ```yaml | |
| 512 | 303 | version: 1 | |
| 513 | 304 | on: | |
| 514 | 305 | push: | |
| 515 | tags: ['v*'] | ||
| 306 | tags: ["v*"] | ||
| 516 | 307 | jobs: | |
| 517 | 308 | release: | |
| 518 | 309 | image: golang:1.27-bookworm | |
| 519 | 310 | steps: | |
| 520 | - name: build | ||
| 521 | run: make dist | ||
| 311 | - run: make dist | ||
| 522 | 312 | artifacts: | |
| 523 | 313 | - path: dist/* | |
| 524 | 314 | release: true | |
| 525 | 315 | ``` | |
| 526 | 316 | ||
| 317 | Push an annotated tag with notes: | ||
| 318 | |||
| 527 | 319 | ```sh | |
| 528 | git tag -a v1.0.0 -m "first release" # needs notes and a tagger | ||
| 529 | git push origin refs/tags/v1.0.0 # the runner builds and publishes | ||
| 320 | git tag -a v1.0.0 -m "First release" | ||
| 321 | git push origin refs/tags/v1.0.0 | ||
| 530 | 322 | ``` | |
| 531 | 323 | ||
| 532 | The release commit on the `vole` branch names the run that produced the files | ||
| 533 | (`release: attach ... from run 01M5...`), so `git log vole` still shows which build | ||
| 534 | shipped them. The run's full record is in `data/runs.db`, not on the branch. A | ||
| 535 | lightweight tag is refused: it has no release notes and no tagger. A tag run never | ||
| 536 | counts as a branch's required check, even if the tag points at that branch's tip. | ||
| 537 | |||
| 538 | See [Releases](releases.md) for the release page and artifact rules. | ||
| 324 | The run attaches the files to that tag's release. A tag run does not count as a | ||
| 325 | required branch check. [Releases](releases.md) covers manual attachment and | ||
| 326 | immutability. | ||
| 539 | 327 | ||
| 540 | 328 | ## Publish a website | |
| 541 | 329 | ||
| 542 | `pages:` publishes a directory as the repository's website, using the same rules | ||
| 543 | as `vole pages deploy`: the branch contains exactly those files, so a page removed | ||
| 544 | from the build stops being served. | ||
| 330 | A job can publish a directory as the repository's site: | ||
| 545 | 331 | ||
| 546 | 332 | ```yaml | |
| 547 | pages: | ||
| 548 | path: site/ | ||
| 333 | jobs: | ||
| 334 | docs: | ||
| 335 | image: alpine:3.22 | ||
| 336 | steps: | ||
| 337 | - run: ./build-site.sh | ||
| 338 | pages: | ||
| 339 | path: site/ | ||
| 340 | ``` | ||
| 341 | |||
| 342 | Only one job in a workflow can publish the site. Vole refuses to deploy when the | ||
| 343 | branch has moved beyond the commit the run built, preventing an older build from | ||
| 344 | rolling the site back. Combined merge-result runs never deploy. See | ||
| 345 | [Sites](sites.md) and [`pages`](reference/workflow-reference.md#pages). | ||
| 346 | |||
| 347 | ## Dispatch and inspect runs | ||
| 348 | |||
| 349 | Start a workflow that declares `workflow-dispatch`: | ||
| 350 | |||
| 351 | ```sh | ||
| 352 | vole workflow dispatch --workflow .vole/workflows/deploy.yaml \ | ||
| 353 | --ref main --input environment=production | ||
| 549 | 354 | ``` | |
| 550 | 355 | ||
| 551 | The commit names the build (`site: main from run 01M5... (6beaa53)`), so | ||
| 552 | `git log pages` shows what put that tree there. | ||
| 356 | Inspect runs and their logs: | ||
| 357 | |||
| 358 | ```sh | ||
| 359 | vole run list --state failed --limit 5 | ||
| 360 | vole run show <run-id> | ||
| 361 | vole run logs <run-id> | ||
| 362 | vole run logs <run-id> --attempt 2 --step 1 | ||
| 363 | ``` | ||
| 553 | 364 | ||
| 554 | Vole refuses the deploy if the run is no longer the newest commit on its branch. | ||
| 555 | An older build finishing late must not silently roll the site back. The run log | ||
| 556 | explains why: | ||
| 365 | Rerun a finished job or cancel an active one: | ||
| 557 | 366 | ||
| 558 | ```text | ||
| 559 | this run built f1f415ec but main is at 6beaa530 now; the site was not deployed | ||
| 367 | ```sh | ||
| 368 | vole run rerun <run-id> | ||
| 369 | vole run cancel <run-id> | ||
| 560 | 370 | ``` | |
| 561 | 371 | ||
| 562 | Only one job per workflow can publish the site. The branch name is set by the | ||
| 563 | instance (`pages_ref`), not by the workflow. | ||
| 564 | |||
| 565 | ## What happens to a queued workflow | ||
| 566 | |||
| 567 | Pushing again cancels queued runs for the commit it replaced. It never stops a run | ||
| 568 | that is already in progress; a maintainer can stop that one from its page or with | ||
| 569 | `vole run cancel <id>`, and the runner stops at its next heartbeat. The attempt that | ||
| 570 | comes back is kept as canceled. | ||
| 571 | |||
| 572 | A run can have more than one attempt. Each time a runner starts the job it records a | ||
| 573 | new attempt, and a runner that disappears hands the job back for another one. After | ||
| 574 | five attempts the run fails instead of cycling. | ||
| 575 | |||
| 576 | An attempt that never reaches the job's first step ends as **could not run**, not | ||
| 577 | **failed**: the image could not be built, the container would not start, or the | ||
| 578 | network the job asked for could not be made. The run page shows the runner's own | ||
| 579 | reason, and the check says the commit is not what failed, so a required check waits | ||
| 580 | instead of going red. It is a rerun away from finishing. A step that exits non-zero | ||
| 581 | is still a failure, and still reds the check, because that one is the code's. A finished run can be queued again | ||
| 582 | with **Rerun** on its page or `vole run rerun <id>`; that is another attempt of the | ||
| 583 | same pinned workflow, image, and secrets, not a new run. A queued or running run | ||
| 584 | cannot be rerun. The run page lists each attempt's log, and the log URL takes | ||
| 585 | `?attempt=N`. From a terminal, `vole run show <id>` prints the result and the | ||
| 586 | attempts, and `vole run logs <id>` writes the default attempt's log (or one retry | ||
| 587 | with `--attempt`, one step with `--step`). | ||
| 588 | |||
| 589 | A run's status is `queued`, `running`, `success`, `failed`, `canceled`, or `error`, | ||
| 590 | which the page calls **could not run**. Only the last two are not a verdict about the | ||
| 591 | commit in the same way: a canceled run was stopped on purpose, and an `error` run | ||
| 592 | never started. | ||
| 593 | |||
| 594 | Finished runs are stored in `data/runs.db`, not on the repository's `vole` branch. | ||
| 595 | For what happens when a runner disappears, how work is requeued, and how finished | ||
| 596 | history is rebuilt, see [Runners § Scheduling and the queue](runner.md#scheduling-and-the-queue). | ||
| 372 | A new push cancels queued runs for the commit it replaced but does not stop a | ||
| 373 | running job. A disappeared runner's job is requeued; after five attempts it | ||
| 374 | fails. An attempt that stops before its first step is **could not run**, not a | ||
| 375 | failure of the commit. [Scheduling and the queue](runner.md#scheduling-and-the-queue) | ||
| 376 | describes retries and storage. | ||
| 377 | |||
| 378 | ## Contributor branches | ||
| 379 | |||
| 380 | Pushes below `refs/heads/contrib/<account>/` do not run CI automatically. A | ||
| 381 | maintainer must choose **Allow CI** on the change request for that exact commit. | ||
| 382 | Every new commit needs another decision. | ||
| 383 | |||
| 384 | Allowing CI executes the proposed workflow and image definitions and delivers | ||
| 385 | any declared repository secrets. Review all three before allowing the run. | ||
| 386 | Protected branches and contributor branches use separate cache namespaces. | ||
| 387 | |||
| 388 | ## Next | ||
| 389 | |||
| 390 | - [Workflow reference](reference/workflow-reference.md) — every field, trigger, | ||
| 391 | default, and limit. | ||
| 392 | - [Set up a runner](deploy/runner.md) — provide a machine that can lease jobs. | ||
| 393 | - [Runner reference](runner.md) — isolation, caching, logs, and scheduling. | ||