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.
Rewrite documentation around reader tasks
d1f44d838966c0a4762073f12375ec7562582fdf · Keenan Nemetz · 21h ago · parent 9103f6a8
docs/workflows.md +1316−39
| @@ -1,17 +1,26 @@ | |||
| 1 | --- | ||
| 2 | mermaid: true | ||
| 3 | --- | ||
| 4 | |||
| 1 | 5 | # Workflows | |
| 2 | 6 | ||
| 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 | Use this page to add the first workflow, run it locally, and choose its events. | ||
| 8 | The [workflow reference](#workflow-reference) owns every field, | ||
| 9 | default, limit, and validation rule. | ||
| 6 | 10 | ||
| 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. | ||
| 11 | <figure class="doc-figure"> | ||
| 12 | <div class="mermaid" data-source="flowchart TB; event["Event<br/>push, tag, issue, schedule, manual"] --> validate["Validate<br/>workflow and image files"]; validate --> queue["Queue<br/>one run per job"]; queue --> lease["Lease<br/>runner with matching labels"]; lease --> execute["Execute<br/>container, services, checkout"]; execute --> outputs["Run outputs<br/>required check · artifacts<br/>site deployment · release files"]"></div> | ||
| 13 | <figcaption>Every matching job is its own run. The event, the pinned workflow, and the runner's result are recorded separately.</figcaption> | ||
| 14 | </figure> | ||
| 10 | 15 | ||
| 11 | 16 | ## Add your first workflow | |
| 12 | 17 | ||
| 13 | Start from a repository clone. To run the workflow locally, you also need Docker, | ||
| 14 | rootless Podman, or nerdctl. | ||
| 18 | Start on the `main` branch of a Go module with tests. For another toolchain, | ||
| 19 | replace the image and test command in the example. | ||
| 20 | |||
| 21 | !!! note "Local runs need a container runtime" | ||
| 22 | Docker, rootless Podman, or nerdctl are only needed for `vole workflow run`. | ||
| 23 | A pushed job runs on a runner; see [Set up a runner](deploy/linux.md#set-up-a-runner-on-linux). | ||
| 15 | 24 | ||
| 16 | 25 | ### 1. Create `.vole/workflows/verify.yaml` | |
| 17 | 26 | ||
| @@ -62,13 +71,22 @@ default Docker. | |||
| 62 | 71 | Local runs ignore triggers and `runs-on`, and do not publish artifacts or sites. | |
| 63 | 72 | Jobs run in declaration order and share the working tree; pushed jobs are | |
| 64 | 73 | independent and start from clean checkouts. See | |
| 65 | [Local execution differences](reference/workflow-reference.md#validation-and-pinning) | ||
| 74 | [Local execution differences](#validation-and-pinning) | ||
| 66 | 75 | and [Run a job locally](#run-a-job-locally). | |
| 67 | 76 | ||
| 68 | ### 4. Commit and push the workflow | ||
| 77 | ### 4. Commit, push, and inspect the run | ||
| 78 | |||
| 79 | ```sh | ||
| 80 | git add .vole/workflows/verify.yaml | ||
| 81 | git commit -m "Run tests in CI" | ||
| 82 | git push origin main | ||
| 83 | vole run list --limit 5 | ||
| 84 | ``` | ||
| 69 | 85 | ||
| 70 | Vole validates it again in pre-receive, queues matching jobs, and records each | ||
| 71 | job as a separate run. | ||
| 86 | Vole validates the workflow again in pre-receive, queues matching jobs, and | ||
| 87 | records each job as a separate run. Use `vole run show <run-id>` for steps and | ||
| 88 | results, or `vole run logs <run-id>` for the log. The runner must offer bridge | ||
| 89 | networking and match the `linux` label for this example to start. | ||
| 72 | 90 | ||
| 73 | 91 | ## Run a job locally | |
| 74 | 92 | ||
| @@ -128,7 +146,7 @@ jobs: | |||
| 128 | 146 | report: | |
| 129 | 147 | image: alpine:3.22 | |
| 130 | 148 | steps: | |
| 131 | - run: jq . "$VOLE_EVENT_PATH" | ||
| 149 | - run: cat "$VOLE_EVENT_PATH" | ||
| 132 | 150 | ``` | |
| 133 | 151 | ||
| 134 | 152 | For non-push events, Vole writes the event to `/run/vole/event.json` and sets | |
| @@ -140,12 +158,12 @@ Issue, comment, and schedule events use the default branch. A manual run uses | |||
| 140 | 158 | its selected `--ref`. A newer event for the same change, issue, or comment | |
| 141 | 159 | cancels the queued runs of the event it replaced; a handler that has already | |
| 142 | 160 | started finishes. See | |
| 143 | [Event data available to steps](reference/workflow-reference.md#event-data-available-to-steps) | ||
| 161 | [Event data available to steps](#event-data-available-to-steps) | ||
| 144 | 162 | for the payload fields. | |
| 145 | 163 | ||
| 146 | 164 | Workflows do not support `${{ }}` expressions or substitution inside `run`. | |
| 147 | 165 | Declare environment variables, inputs, and secrets explicitly. The | |
| 148 | [context and expressions reference](reference/workflow-reference.md#context-and-expressions) | ||
| 166 | [context and expressions reference](#context-and-expressions) | ||
| 149 | 167 | explains the constraint. | |
| 150 | 168 | ||
| 151 | 169 | ### Filter automation by author | |
| @@ -170,13 +188,18 @@ on: | |||
| 170 | 188 | `author.role: maintainer` admits maintainers and admins. Use `author.name` for a | |
| 171 | 189 | list of specific accounts. Assignment alone is not an authorization boundary | |
| 172 | 190 | because the issue author can assign their own issue. Mentions in code samples do | |
| 173 | not match. [Event filters](reference/workflow-reference.md#event-filters) defines | ||
| 191 | not match. [Event filters](#event-filters) defines | ||
| 174 | 192 | all filter combinations. | |
| 175 | 193 | ||
| 176 | 194 | A job with `acts-as: coding-agent` receives a per-run credential for that bot. | |
| 177 | 195 | The credential has the bot's repository role and expires with the run. See | |
| 178 | 196 | [Bot accounts](accounts-and-access.md#bot-accounts) and | |
| 179 | [`acts-as`](reference/workflow-reference.md#acts-as). | ||
| 197 | [`acts-as`](#acts-as). | ||
| 198 | |||
| 199 | ## Common job shapes | ||
| 200 | |||
| 201 | Images, services, secrets, artifacts, releases, and site deployment are common | ||
| 202 | job shapes rather than first-run steps. Each section below is one worked example. | ||
| 180 | 203 | ||
| 181 | 204 | ## Images | |
| 182 | 205 | ||
| @@ -215,7 +238,7 @@ jobs: | |||
| 215 | 238 | Vole pins the definition with the queued run. The runner builds it locally and | |
| 216 | 239 | caches it by digest. Image build commands execute repository code, so review | |
| 217 | 240 | changes to definitions with the same care as workflow steps. See the | |
| 218 | [image reference](reference/image-reference.md) and | ||
| 241 | [image reference](#image-reference) and | ||
| 219 | 242 | [runner image builds](runner.md#images-and-image-builds). | |
| 220 | 243 | ||
| 221 | 244 | ## Network and services | |
| @@ -246,10 +269,10 @@ have no checkout, cache, or secrets. Vole does not perform health checks, so the | |||
| 246 | 269 | first step must wait until the service accepts connections. | |
| 247 | 270 | ||
| 248 | 271 | Service containers run as the job's unprivileged user; point writable data such | |
| 249 | as `PGDATA` at `/tmp`. See [`services`](reference/workflow-reference.md#services) | ||
| 272 | as `PGDATA` at `/tmp`. See [`services`](#services) | ||
| 250 | 273 | for limits and lifecycle. | |
| 251 | 274 | ||
| 252 | ## Secrets | ||
| 275 | ## Repository secrets | ||
| 253 | 276 | ||
| 254 | 277 | Maintainers store repository secrets on the instance: | |
| 255 | 278 | ||
| @@ -276,13 +299,14 @@ A missing value leaves the variable unset and adds a note to the log. The shell | |||
| 276 | 299 | check above makes it required instead. Vole masks delivered values in logs, but | |
| 277 | 300 | not transformed values or files published as artifacts and sites. | |
| 278 | 301 | ||
| 279 | Every account that may run this repository's jobs can read the secrets those jobs | ||
| 280 | declare. That is the `runner` role, plus maintainers and admins. Allow CI only for | ||
| 281 | code you would trust with those values. See | ||
| 282 | [`secrets`](reference/workflow-reference.md#secrets) and | ||
| 283 | [runner trust](runner.md#the-runners-account). | ||
| 302 | !!! warning "Secrets go to anyone who can run the job" | ||
| 303 | Every account that may run this repository's jobs can read the secrets those | ||
| 304 | jobs declare: the `runner` role, maintainers, and admins. Allow CI only for | ||
| 305 | code you would trust with those values. See | ||
| 306 | [`secrets`](#secrets) and | ||
| 307 | [runner trust](runner.md#register-and-authorize-the-runner). | ||
| 284 | 308 | ||
| 285 | ## Artifacts | ||
| 309 | ## Run artifacts | ||
| 286 | 310 | ||
| 287 | 311 | Declare files to upload after all steps pass: | |
| 288 | 312 | ||
| @@ -300,7 +324,7 @@ A pattern that matches nothing fails the job. Vole also rejects duplicate base | |||
| 300 | 324 | names. Run artifacts remain attached to their run and are separate from release | |
| 301 | 325 | artifacts. The runner that builds the job needs the `runner` role; `reader` alone | |
| 302 | 326 | cannot lease a job or upload an artifact. See | |
| 303 | [`artifacts`](reference/workflow-reference.md#artifacts). | ||
| 327 | [`artifacts`](#artifacts). | ||
| 304 | 328 | ||
| 305 | 329 | ## Build a release | |
| 306 | 330 | ||
| @@ -330,7 +354,7 @@ git push origin refs/tags/v1.0.0 | |||
| 330 | 354 | ||
| 331 | 355 | The run attaches the files to that tag's release. A tag run does not count as a | |
| 332 | 356 | required branch check. [Releases](releases.md) covers manual attachment and | |
| 333 | immutability. | ||
| 357 | channel freezing. | ||
| 334 | 358 | ||
| 335 | 359 | ## Publish a website | |
| 336 | 360 | ||
| @@ -359,7 +383,7 @@ vole admin acl set-role demo ci-runner-1 runner | |||
| 359 | 383 | ||
| 360 | 384 | That role, not `reader`, authorizes the push to the instance's `pages_ref` branch. | |
| 361 | 385 | It grants no other branch. See [Sites](sites.md) and | |
| 362 | [`pages`](reference/workflow-reference.md#pages). | ||
| 386 | [`pages`](#pages). | ||
| 363 | 387 | ||
| 364 | 388 | ## Dispatch and inspect runs | |
| 365 | 389 | ||
| @@ -395,17 +419,1270 @@ describes retries and storage. | |||
| 395 | 419 | ||
| 396 | 420 | ## Contributor branches | |
| 397 | 421 | ||
| 398 | Pushes below `refs/heads/contrib/<account>/` do not run CI automatically. A | ||
| 399 | maintainer must choose **Allow CI** on the change request for that exact commit. | ||
| 400 | Every new commit needs another decision. | ||
| 422 | !!! warning "Contributor CI runs unreviewed code" | ||
| 423 | Pushes below `refs/heads/contrib/<account>/` do not run CI automatically. A | ||
| 424 | maintainer must choose **Allow CI** on the change request for that exact | ||
| 425 | commit, and every new commit needs another decision. | ||
| 426 | |||
| 427 | Allowing CI executes the proposed workflow and image definitions and delivers | ||
| 428 | any declared repository secrets. Review all three before allowing the run. | ||
| 429 | Protected branches and contributor branches use separate cache namespaces. | ||
| 430 | |||
| 431 | ## Workflow reference | ||
| 432 | |||
| 433 | This section lists every field Vole accepts in `.vole/workflows/*.yaml`, with | ||
| 434 | its defaults and limits. For `.vole/images` definitions, see | ||
| 435 | [Image reference](#image-reference). | ||
| 436 | |||
| 437 | Unknown keys are rejected. A workflow is validated when it is pushed and again by | ||
| 438 | `vole workflow check`, so a typo fails before a job is queued. | ||
| 439 | |||
| 440 | ### File location and limits | ||
| 441 | |||
| 442 | | Item | Value | | ||
| 443 | |---|---| | ||
| 444 | | Location | Directly under `.vole/workflows/`; subdirectories are rejected | | ||
| 445 | | Extension | `.yaml` or `.yml` | | ||
| 446 | | Maximum file size | 256 KiB | | ||
| 447 | | Schema version | `1` | | ||
| 448 | | Maximum jobs per workflow | 50 | | ||
| 449 | | Maximum steps per job | 100 | | ||
| 450 | | Maximum artifact declarations per job | 32 | | ||
| 451 | | Maximum artifact files per run | 256 | | ||
| 452 | | Maximum artifact bytes per run | 4 GiB | | ||
| 453 | | Maximum attempt log | 32 MiB (then truncated with a note) | | ||
| 454 | | Maximum `runs-on` labels per job | 8 | | ||
| 455 | | Maximum step command size | 64 KiB | | ||
| 456 | | Maximum secret value | 128 KiB (`NAME=value`, the kernel's environment limit) | | ||
| 457 | | Maximum secret name | 64 bytes | | ||
| 458 | | Maximum display name | 80 bytes | | ||
| 459 | | Maximum description | 500 bytes | | ||
| 460 | | Maximum path filters | 20 per list | | ||
| 461 | | Maximum accounts per event filter | 10 per list | | ||
| 462 | | Maximum mentions read from one body | 32 | | ||
| 463 | | Maximum schedules | 5 | | ||
| 464 | | Maximum manual inputs | 10 | | ||
| 465 | | Maximum event payload | 64 KiB | | ||
| 466 | | Default step timeout | 10 minutes, when the job has no budget | | ||
| 467 | | Maximum step timeout | 4 hours | | ||
| 468 | | Maximum job timeout | 4 hours | | ||
| 469 | |||
| 470 | ### Top-level fields | ||
| 471 | |||
| 472 | | Field | Type | Required | Default | Meaning | | ||
| 473 | |---|---|---|---|---| | ||
| 474 | | `version` | integer | yes | — | Schema version. Must be `1`. | | ||
| 475 | | `name` | string | no | the workflow file's base name | Display name on the run page. | | ||
| 476 | | `description` | string | no | none | One-line summary of what the workflow is for. | | ||
| 477 | | `on` | mapping | no | — | Trigger configuration. | | ||
| 478 | | `on.push.branches` | list of strings | no | `["*"]` for a workflow with no other trigger | Branch patterns that trigger the workflow. | | ||
| 479 | | `on.push.tags` | list of strings | no | none | Tag patterns that trigger the workflow. | | ||
| 480 | | `on.push.paths` | list of strings | no | none | Path patterns a push must touch. | | ||
| 481 | | `on.push.paths-ignore` | list of strings | no | none | Path patterns a push must not change. | | ||
| 482 | | `on.change-request` | mapping or empty | no | none | Change-request actions that trigger the workflow. | | ||
| 483 | | `on.issue` | mapping or empty | no | none | Issue actions that trigger the workflow. | | ||
| 484 | | `on.comment` | mapping or empty | no | none | Comment actions that trigger the workflow. | | ||
| 485 | | `on.change-request.mentioned` | string or list | no | none | Body must mention one of these accounts. | | ||
| 486 | | `on.change-request.author` | mapping, string or list | no | none | Sender name allowlist and/or minimum role. | | ||
| 487 | | `on.issue.mentioned` | string or list | no | none | Body must mention one of these accounts. | | ||
| 488 | | `on.issue.assigned-to` | string or list | no | none | This event must assign one of these accounts. | | ||
| 489 | | `on.issue.author` | mapping, string or list | no | none | Sender name allowlist and/or minimum role. | | ||
| 490 | | `on.comment.mentioned` | string or list | no | none | Body must mention one of these accounts. | | ||
| 491 | | `on.comment.replied-to` | string or list | no | none | Parent comment must be by one of these accounts. | | ||
| 492 | | `on.comment.author` | mapping, string or list | no | none | Sender name allowlist and/or minimum role. | | ||
| 493 | | `on.schedule` | list of mappings | no | none | Cron schedules, in UTC. | | ||
| 494 | | `on.workflow-dispatch` | mapping or empty | no | none | A manual run, optionally with typed inputs. | | ||
| 495 | | `jobs` | mapping | yes | — | One or more jobs, keyed by job ID. | | ||
| 496 | |||
| 497 | #### `version` | ||
| 498 | |||
| 499 | The only supported value is `1`: | ||
| 500 | |||
| 501 | ```yaml | ||
| 502 | version: 1 | ||
| 503 | ``` | ||
| 504 | |||
| 505 | #### Workflow `name` | ||
| 506 | |||
| 507 | A display name for the workflow. The file path stays the identity — it is what a | ||
| 508 | run records and what `vole workflow run` selects — while `name` is what a reader | ||
| 509 | sees on a run page: | ||
| 510 | |||
| 511 | ```yaml | ||
| 512 | name: Verify main | ||
| 513 | ``` | ||
| 514 | |||
| 515 | When `name` is absent or empty, the workflow is shown by its file's base name, so | ||
| 516 | `.vole/workflows/verify.yaml` is shown as `verify`. | ||
| 517 | |||
| 518 | The name is trimmed and must be one line of text, at most 80 bytes. It is display | ||
| 519 | metadata; two workflows may share a name. | ||
| 520 | |||
| 521 | #### Workflow `description` | ||
| 522 | |||
| 523 | A one-line summary of what the workflow is for, shown under its name on each | ||
| 524 | run page: | ||
| 525 | |||
| 526 | ```yaml | ||
| 527 | description: Build, test and lint every push to main. | ||
| 528 | ``` | ||
| 529 | |||
| 530 | The description is trimmed and must be one line of text, at most 500 bytes. It is | ||
| 531 | optional; an absent description shows nothing. | ||
| 532 | |||
| 533 | #### `on.push.branches` | ||
| 534 | |||
| 535 | A list of branch patterns. The default depends on what else is present: | ||
| 536 | |||
| 537 | - A workflow with no `on` trigger at all is an ordinary push ci and runs on every | ||
| 538 | branch. | ||
| 539 | - `branches` present: only matching branches trigger it. | ||
| 540 | - `tags` present without `branches`: the workflow runs only on matching tags. | ||
| 541 | - A workflow with only event triggers (`change_request`, `issue`, `comment`, | ||
| 542 | `schedule`, `workflow_dispatch`) does not run on a branch push. | ||
| 543 | - `push:` with neither `branches` nor `tags` runs on every branch. | ||
| 544 | |||
| 545 | Patterns use `path.Match` semantics with one special case: a lone `*` matches every | ||
| 546 | branch, including names containing `/`. Other patterns keep the one-segment rule, | ||
| 547 | so `release/*` does not match `release/1.0/hotfix`. | ||
| 548 | |||
| 549 | Patterns may contain letters, digits, `*`, `?`, `[`, `]`, `!`, `.`, `_`, `/` and | ||
| 550 | `-`. Empty patterns and patterns containing `..` are rejected. | ||
| 551 | |||
| 552 | A leading `!` excludes what an earlier pattern included. The last matching pattern | ||
| 553 | wins, so `["*", "!main"]` runs everywhere except `main`: | ||
| 554 | |||
| 555 | ```yaml | ||
| 556 | on: | ||
| 557 | push: | ||
| 558 | branches: [main, "release/*"] | ||
| 559 | ``` | ||
| 560 | |||
| 561 | ```yaml | ||
| 562 | on: | ||
| 563 | push: | ||
| 564 | branches: ["*", "!main"] | ||
| 565 | ``` | ||
| 566 | |||
| 567 | An explicitly empty list means no branches trigger the workflow. | ||
| 568 | |||
| 569 | #### `on.push.tags` | ||
| 570 | |||
| 571 | A list of tag patterns. Tags have no default: a workflow runs on a tag only when | ||
| 572 | `tags:` is present and the tag matches. | ||
| 573 | |||
| 574 | ```yaml | ||
| 575 | on: | ||
| 576 | push: | ||
| 577 | tags: ["v*"] | ||
| 578 | ``` | ||
| 579 | |||
| 580 | Patterns follow the same rules as branch patterns, including `!` exclusion. A | ||
| 581 | workflow with `tags` and no `branches` runs on tags only. A workflow with both runs | ||
| 582 | on matching branches and matching tags. | ||
| 583 | |||
| 584 | #### `on.push.paths` | ||
| 585 | |||
| 586 | A push runs only when at least one changed path matches one of these patterns. | ||
| 587 | Patterns are relative to the repository root. `*` stays inside one path segment; | ||
| 588 | `**` spans zero or more segments, so `docs/**` covers `docs/` and everything under | ||
| 589 | it. At most 20 patterns may be declared. | ||
| 590 | |||
| 591 | ```yaml | ||
| 592 | on: | ||
| 593 | push: | ||
| 594 | paths: ["src/**", "cmd/**", "go.mod"] | ||
| 595 | ``` | ||
| 596 | |||
| 597 | An empty pattern, an absolute path, or a pattern containing `..` is rejected. A | ||
| 598 | push that changes no files does not match a workflow with a path filter. | ||
| 599 | |||
| 600 | #### `on.push.paths-ignore` | ||
| 601 | |||
| 602 | Paths that do not trigger the workflow. An ignored path is removed before the | ||
| 603 | allow list is consulted, so an ignored file cannot make a workflow run: | ||
| 401 | 604 | ||
| 402 | Allowing CI executes the proposed workflow and image definitions and delivers | ||
| 403 | any declared repository secrets. Review all three before allowing the run. | ||
| 404 | Protected branches and contributor branches use separate cache namespaces. | ||
| 605 | ```yaml | ||
| 606 | on: | ||
| 607 | push: | ||
| 608 | paths-ignore: ["docs/**", "**/*.md"] | ||
| 609 | ``` | ||
| 610 | |||
| 611 | `paths` and `paths-ignore` may be combined. When every changed path is ignored, | ||
| 612 | nothing runs. Both filters are evaluated against the range the push changed; a new | ||
| 613 | branch or tag has no previous tree, so every file counts as changed. | ||
| 614 | |||
| 615 | #### `on.change-request` | ||
| 616 | |||
| 617 | Runs when a change request changes. The run is checked out at the request's base | ||
| 618 | branch tip, not at the proposed head: an event run must not be a way to execute an | ||
| 619 | unapproved contributor commit. The proposed head and the changed files are in the | ||
| 620 | event payload. | ||
| 621 | |||
| 622 | ```yaml | ||
| 623 | on: | ||
| 624 | change-request: | ||
| 625 | types: [opened, updated, ready] | ||
| 626 | ``` | ||
| 627 | |||
| 628 | | Action | Meaning | | ||
| 629 | |---|---| | ||
| 630 | | `opened` | A request was created. | | ||
| 631 | | `updated` | Its head, base, title, description, or followed branch changed. | | ||
| 632 | | `ready` | The required approvals for the exact base and head were reached. | | ||
| 633 | | `closed` | It was closed without landing. | | ||
| 634 | | `merged` | It landed. | | ||
| 635 | |||
| 636 | The default is `[opened, updated, ready]`. An empty value means the default: | ||
| 637 | `change-request:` and `change-request: {}` are the same. | ||
| 638 | |||
| 639 | #### `on.issue` | ||
| 640 | |||
| 641 | Runs when an issue changes, at the default branch tip. | ||
| 642 | |||
| 643 | ```yaml | ||
| 644 | on: | ||
| 645 | issue: | ||
| 646 | types: [opened, closed] | ||
| 647 | ``` | ||
| 648 | |||
| 649 | Actions are `opened`, `edited`, `assigned`, `closed`, and `reopened`. The default is `[opened]`. | ||
| 650 | An empty value means the default. `assigned` is queued when an edit adds an | ||
| 651 | assignee. An issue opened with an assignee already set queues `opened`, and its | ||
| 652 | `assignees_added` list makes that an assignment for `assigned-to`. | ||
| 653 | |||
| 654 | #### `on.comment` | ||
| 655 | |||
| 656 | Runs when a comment on an issue or a change request is created, edited, or deleted. | ||
| 657 | The payload names the comment and the issue or change request it belongs to. | ||
| 658 | |||
| 659 | ```yaml | ||
| 660 | on: | ||
| 661 | comment: | ||
| 662 | types: [created] | ||
| 663 | ``` | ||
| 664 | |||
| 665 | Actions are `created`, `edited`, and `deleted`. The default is `[created]`. An | ||
| 666 | empty value means the default. | ||
| 667 | |||
| 668 | #### Event filters | ||
| 669 | |||
| 670 | `on.change-request`, `on.issue`, and `on.comment` accept filter fields beside | ||
| 671 | `types`. They select within the event's action list; they do not change which | ||
| 672 | actions the trigger has to declare. | ||
| 673 | |||
| 674 | ```yaml | ||
| 675 | on: | ||
| 676 | issue: | ||
| 677 | types: [opened, assigned] | ||
| 678 | assigned-to: [coding-agent] | ||
| 679 | comment: | ||
| 680 | types: [created] | ||
| 681 | mentioned: [coding-agent] | ||
| 682 | replied-to: [coding-agent] | ||
| 683 | author: | ||
| 684 | name: [keenan] | ||
| 685 | role: maintainer | ||
| 686 | ``` | ||
| 687 | |||
| 688 | | Field | Availability | Meaning | | ||
| 689 | |---|---|---| | ||
| 690 | | `mentioned` | change request, issue, comment | The event body names one of these accounts. | | ||
| 691 | | `replied-to` | comment | The comment answers a comment written by one of these accounts. | | ||
| 692 | | `assigned-to` | issue | This event added one of these accounts as an assignee, including assignees set when the issue was opened. | | ||
| 693 | | `author.name` | change request, issue, comment | The account that caused the event is one of these. | | ||
| 694 | | `author.role` | change request, issue, comment | The account that caused the event holds at least this repository role. | | ||
| 695 | |||
| 696 | The account filters (`mentioned`, `replied-to`, `assigned-to`, and `author.name`) | ||
| 697 | take one account or a list of accounts, at most 10. Names follow the account-name | ||
| 698 | rule: 2–32 characters, lowercase letters, digits, `-` and `_`. A leading `@` is | ||
| 699 | accepted and removed. An explicitly empty list is rejected because a filter that | ||
| 700 | can never match has no visible symptom. | ||
| 701 | |||
| 702 | `author` may also be written as one account or a list, which is shorthand for | ||
| 703 | `author.name`: | ||
| 704 | |||
| 705 | ```yaml | ||
| 706 | author: keenan | ||
| 707 | author: [keenan, wilbur] | ||
| 708 | ``` | ||
| 709 | |||
| 710 | `author.name`, `author.role`, and `assigned-to` must match when present. | ||
| 711 | `mentioned` and `replied-to` are alternatives: a comment qualifies if it mentions | ||
| 712 | an account or answers an account, so a workflow that should run for either can | ||
| 713 | declare both. A comment is never treated as addressed to its own author, which | ||
| 714 | keeps an agent's reply from waking itself. | ||
| 715 | |||
| 716 | `author.role` is the ACL filter. Its value is one role — `reader`, `contributor`, | ||
| 717 | `runner`, `maintainer`, or `admin` — and it means "at least this role" for the | ||
| 718 | effective repository role of the account that caused the event. A `runner` filter | ||
| 719 | admits runners, maintainers, and admins and refuses contributors and readers. | ||
| 720 | `none` is rejected because it would filter nothing. Use it when the rule is a | ||
| 721 | capability rather than a list of names: | ||
| 722 | |||
| 723 | ```yaml | ||
| 724 | on: | ||
| 725 | comment: | ||
| 726 | types: [created] | ||
| 727 | mentioned: [coding-agent] | ||
| 728 | author: | ||
| 729 | role: maintainer | ||
| 730 | ``` | ||
| 731 | |||
| 732 | The role is resolved when the event is queued, from the repository's access rules | ||
| 733 | and the instance-wide role attached to them. Changing the rules later does not | ||
| 734 | change a run that is already queued. | ||
| 735 | |||
| 736 | `author.role` is a policy gate on the recorded sender, not a substitute for | ||
| 737 | authentication. Contributors reach the metadata branch through the browser, which | ||
| 738 | records their session account, and writing that branch directly already requires | ||
| 739 | the `maintainer` role. A role above `maintainer` is therefore not protection | ||
| 740 | against a malicious maintainer with direct push access. | ||
| 741 | |||
| 742 | The mention syntax is `@name`. Mentions inside inline code or a fenced code block | ||
| 743 | are ignored, as is the `@` in an email address or a URL. A body contributes at | ||
| 744 | most 32 distinct mentions to the event. | ||
| 745 | |||
| 746 | A filter is evaluated when the event is queued. `author` names the person whose | ||
| 747 | write caused the event: the comment author, the issue author or editor, or the | ||
| 748 | maintainer who assigned the issue. | ||
| 749 | |||
| 750 | #### `on.schedule` | ||
| 751 | |||
| 752 | Cron schedules in UTC. A schedule queues the workflow at the default branch tip. | ||
| 753 | The field syntax is five fields — minute, hour, day of month, month, day of week — | ||
| 754 | with `*`, lists, ranges, and a step on `*` or a range. Names and `@shorthands` are | ||
| 755 | not accepted. | ||
| 756 | |||
| 757 | ```yaml | ||
| 758 | on: | ||
| 759 | schedule: | ||
| 760 | - cron: "0 3 * * 1-5" | ||
| 761 | ``` | ||
| 762 | |||
| 763 | At most 5 schedules may be declared. The run is queued once per matching minute; | ||
| 764 | a server that was not running for a slot does not replay it later. | ||
| 765 | |||
| 766 | #### `on.workflow-dispatch` | ||
| 767 | |||
| 768 | Marks a workflow as runnable by hand. The CLI has `vole workflow dispatch`. | ||
| 769 | |||
| 770 | ```yaml | ||
| 771 | on: | ||
| 772 | workflow-dispatch: | ||
| 773 | inputs: | ||
| 774 | environment: | ||
| 775 | description: Where to deploy | ||
| 776 | type: choice | ||
| 777 | required: true | ||
| 778 | default: staging | ||
| 779 | options: [staging, production] | ||
| 780 | dry-run: | ||
| 781 | type: boolean | ||
| 782 | default: "true" | ||
| 783 | ``` | ||
| 784 | |||
| 785 | | Input field | Meaning | | ||
| 786 | |---|---| | ||
| 787 | | `description` | One line shown beside the field. | | ||
| 788 | | `type` | `string`, `boolean`, `number`, or `choice`. Default `string`. | | ||
| 789 | | `required` | The run is refused when the input has no value and no default. | | ||
| 790 | | `default` | Value used when the input is omitted. | | ||
| 791 | | `options` | The allowed values for `choice`. | | ||
| 792 | |||
| 793 | At most 10 inputs may be declared. A value must be one line and at most 4 KiB. | ||
| 794 | `choice` inputs need at least one option, and the default must be one of them. | ||
| 795 | A manual run is available to maintainers and instance admins, and the selected | ||
| 796 | branch must exist. | ||
| 797 | |||
| 798 | #### Event data available to steps | ||
| 799 | |||
| 800 | Every run has a `trigger_kind` (`push`, `change_request`, `issue`, `comment`, | ||
| 801 | `schedule`, or `workflow_dispatch`) and an action. A run started by a non-push | ||
| 802 | trigger also gets three variables: | ||
| 803 | |||
| 804 | | Variable | Value | | ||
| 805 | |---|---| | ||
| 806 | | `VOLE_EVENT` | The trigger kind, such as `comment`. | | ||
| 807 | | `VOLE_EVENT_ACTION` | The action, such as `created`. | | ||
| 808 | | `VOLE_EVENT_PATH` | Path to a JSON file, `/run/vole/event.json`. | | ||
| 809 | |||
| 810 | The JSON is pinned when the run is queued. It is data: read it with `jq` or a | ||
| 811 | program, never by interpolating it into a shell command. Common fields are | ||
| 812 | `event`, `action`, `repository`, `ref`, `branch`, `commit`, `sender`, and for a | ||
| 813 | change request `base_sha`, `head_sha`, and `changed_files`. The entity is under | ||
| 814 | `issue`, `change_request`, or `comment`; a manual run puts its resolved values | ||
| 815 | under `inputs`. An issue or change request carries `mentions` in its entity. An | ||
| 816 | issue also carries `assignees_added` and `assignees_removed`. A comment carries | ||
| 817 | `mentions`, `reply_to_author`, and `reply_to`. Long bodies are clipped at 16 KiB | ||
| 818 | and the payload marks that with `body_truncated`. | ||
| 819 | |||
| 820 | These variables are set by the runner and cannot be replaced by a workflow's | ||
| 821 | `env:`, the same rule as `CI` and `HOME`. | ||
| 822 | |||
| 823 | #### `jobs` | ||
| 824 | |||
| 825 | A mapping of job IDs to job definitions. Job IDs must match: | ||
| 826 | |||
| 827 | ```text | ||
| 828 | ^[a-z][a-z0-9_-]{0,31}$ | ||
| 829 | ``` | ||
| 830 | |||
| 831 | That is 1–32 characters: lowercase letters, digits, `_` and `-`, starting with a | ||
| 832 | letter. At least one job is required. | ||
| 833 | |||
| 834 | ### Job fields | ||
| 835 | |||
| 836 | | Field | Type | Required | Default | Meaning | | ||
| 837 | |---|---|---|---|---| | ||
| 838 | | `name` | string | no | the job ID | Display name on the run page. | | ||
| 839 | | `description` | string | no | none | One-line summary of what the job does. | | ||
| 840 | | `image` | string | one of `image` / `image-file` | — | Registry image the job runs in. | | ||
| 841 | | `image-file` | string | one of `image` / `image-file` | — | Name of a definition under `.vole/images/`. | | ||
| 842 | | `runs-on` | string or list of strings | no | any runner | Runner labels the job requires. | | ||
| 843 | | `network` | `none` or `bridge` | no | the runner's setting | Whether the job's container has a network. | | ||
| 844 | | `services` | mapping | no | none | Containers started beside the job, reached by name. | | ||
| 845 | | `secrets` | string or list of strings | no | none | Repository secrets the job reads, by name. Each name is also the variable a step finds it in. | | ||
| 846 | | `acts-as` | account name | no | none | A bot account the job acts as, with a credential for that run. | | ||
| 847 | | `env` | mapping | no | none | Environment every step of the job runs with. | | ||
| 848 | | `timeout` | duration string | no | none | Wall clock the job's steps share. | | ||
| 849 | | `steps` | list | yes | — | Commands the job runs. At least one is required. | | ||
| 850 | | `artifacts` | list | no | none | Files the job publishes. | | ||
| 851 | | `pages` | mapping | no | none | Directory published as the repository's website. | | ||
| 852 | |||
| 853 | Exactly one of `image` and `image-file` must be present. Declaring both, or | ||
| 854 | neither, is an error. | ||
| 855 | |||
| 856 | #### Job `name` | ||
| 857 | |||
| 858 | A display name for the job, shown on the run page in place of the job ID: | ||
| 859 | |||
| 860 | ```yaml | ||
| 861 | jobs: | ||
| 862 | test: | ||
| 863 | name: Unit tests | ||
| 864 | ``` | ||
| 865 | |||
| 866 | When `name` is absent or empty, the job is shown by its ID. The ID stays the key | ||
| 867 | that a run, a lease and `vole workflow run --job` use. | ||
| 868 | |||
| 869 | The name is trimmed and must be one line of text, at most 80 bytes. | ||
| 870 | |||
| 871 | #### Job `description` | ||
| 872 | |||
| 873 | An optional one-line summary of what the job does: | ||
| 874 | |||
| 875 | ```yaml | ||
| 876 | jobs: | ||
| 877 | test: | ||
| 878 | name: Unit tests | ||
| 879 | description: Runs the Go tests against the pinned toolchain. | ||
| 880 | ``` | ||
| 881 | |||
| 882 | The description is trimmed and must be one line of text, at most 500 bytes. | ||
| 883 | |||
| 884 | #### `image` | ||
| 885 | |||
| 886 | An OCI image reference used exactly as written: | ||
| 887 | |||
| 888 | ```yaml | ||
| 889 | jobs: | ||
| 890 | build: | ||
| 891 | image: golang:1.27-bookworm@sha256:... | ||
| 892 | ``` | ||
| 893 | |||
| 894 | The runner pulls and runs this image. Pin it by digest when reproducibility | ||
| 895 | matters; a mutable tag can change between runs. | ||
| 896 | |||
| 897 | References are limited to 255 bytes and must start with a letter or digit. They may | ||
| 898 | contain letters, digits, `.`, `_`, `/`, `:`, `@`, `+`, `~` and `-`. A leading `-`, | ||
| 899 | `..`, `://`, or a `file:` prefix is rejected. `file:` is reserved for | ||
| 900 | `image-file:`. | ||
| 901 | |||
| 902 | #### `image-file` | ||
| 903 | |||
| 904 | The name of a definition under `.vole/images/`: | ||
| 905 | |||
| 906 | ```yaml | ||
| 907 | jobs: | ||
| 908 | build: | ||
| 909 | image-file: go | ||
| 910 | ``` | ||
| 911 | |||
| 912 | `image-file: go` resolves `.vole/images/go.yaml`. The `.yaml` or `.yml` extension | ||
| 913 | is optional in the reference; `image-file: go.yaml` is also accepted. | ||
| 914 | |||
| 915 | Names are 1–64 characters: lowercase letters, digits, `.`, `_` and `-`, starting | ||
| 916 | with a letter or digit. A definition must live directly under `.vole/images/`, not | ||
| 917 | in a subdirectory. Two files for the same name (`go.yaml` and `go.yml`) are | ||
| 918 | rejected as ambiguous. | ||
| 919 | |||
| 920 | The definition is validated and pinned when the run is queued. See | ||
| 921 | [Image reference](#image-reference) for its fields and limits. | ||
| 922 | |||
| 923 | #### `runs-on` | ||
| 924 | |||
| 925 | A single label or a list of labels: | ||
| 926 | |||
| 927 | ```yaml | ||
| 928 | runs-on: linux | ||
| 929 | runs-on: [linux, arm64] | ||
| 930 | ``` | ||
| 931 | |||
| 932 | A runner must carry every listed label to receive the job. An absent or empty | ||
| 933 | `runs-on` means any runner may take the job. Duplicate labels are ignored; at most | ||
| 934 | 8 labels may be declared. Each label must match: | ||
| 935 | |||
| 936 | ```text | ||
| 937 | ^[a-z0-9][a-z0-9._-]{0,31}$ | ||
| 938 | ``` | ||
| 939 | |||
| 940 | That is 1–32 characters: lowercase letters, digits, `.`, `_` and `-`, starting | ||
| 941 | with a letter or digit. | ||
| 942 | |||
| 943 | See [Runners § Start a runner](runner.md#start-a-runner) for how a machine | ||
| 944 | advertises labels. | ||
| 945 | |||
| 946 | #### `network` | ||
| 947 | |||
| 948 | Whether the job's container can reach anything outside it: | ||
| 949 | |||
| 950 | ```yaml | ||
| 951 | jobs: | ||
| 952 | fetch: | ||
| 953 | image: golang:1.27-bookworm | ||
| 954 | network: bridge | ||
| 955 | steps: | ||
| 956 | - run: go mod download | ||
| 957 | ``` | ||
| 958 | |||
| 959 | `bridge` gives the container a network. `none` withholds it, and a step that tries | ||
| 960 | to reach out then fails to resolve a host, which is the answer a job that does not | ||
| 961 | need the network should get. Only these two values are accepted; there is no | ||
| 962 | `host`, because a job that shares the runner's network is not isolated from it. | ||
| 963 | |||
| 964 | Both names are the modes every supported runtime takes for `--network`, so the same | ||
| 965 | workflow means the same thing on Docker, rootless Podman, and nerdctl. What the | ||
| 966 | network is underneath differs — Docker's own bridge, Podman's userspace stack, | ||
| 967 | nerdctl's CNI bridge — and that is the machine's business: the field says whether a | ||
| 968 | job may reach out, not how the runner provides the route. | ||
| 969 | |||
| 970 | The job decides, and the machine's own setting fills in only when the field is | ||
| 971 | absent: | ||
| 972 | |||
| 973 | | Job says | Runner can give bridge | Runner cannot | | ||
| 974 | |---|---|---| | ||
| 975 | | nothing | bridge, as the runner was started | none, as the runner was started | | ||
| 976 | | `none` | none | none | | ||
| 977 | | `bridge` | bridge | the job waits for a runner that can | | ||
| 978 | |||
| 979 | A job that asks for `bridge` is only leased to a runner started with | ||
| 980 | `--container-network bridge`, so it waits for a capable machine instead of running | ||
| 981 | without the network it asked for. A job that asks for `none` gets none from either | ||
| 982 | kind of runner, so the same workflow is isolated the same way everywhere. | ||
| 983 | |||
| 984 | A `vole workflow run` applies the same rule: the job's request wins over the | ||
| 985 | command line, and a `bridge` job is refused when the local run was started with | ||
| 986 | `--container-network none`. | ||
| 987 | |||
| 988 | #### `services` | ||
| 989 | |||
| 990 | Containers started beside the job, for the servers a test or a build talks to: | ||
| 991 | |||
| 992 | ```yaml | ||
| 993 | jobs: | ||
| 994 | test: | ||
| 995 | image: golang:1.27-bookworm | ||
| 996 | network: bridge | ||
| 997 | services: | ||
| 998 | db: | ||
| 999 | image: postgres:17 | ||
| 1000 | env: | ||
| 1001 | POSTGRES_PASSWORD: test | ||
| 1002 | PGDATA: /tmp/pgdata | ||
| 1003 | steps: | ||
| 1004 | - run: | | ||
| 1005 | DATABASE_URL=postgres://postgres:test@db:5432/postgres go test ./... | ||
| 1006 | ``` | ||
| 1007 | |||
| 1008 | A service is a container, not a job: it has no steps, no checkout, no secrets, and | ||
| 1009 | no host mount, and it runs the image's own command. The service's name is its | ||
| 1010 | hostname on a private network the runner creates for the attempt. The job and its | ||
| 1011 | services are the only members, so `db:5432` is the address a step uses and two | ||
| 1012 | services may listen on the same port. | ||
| 1013 | |||
| 1014 | **A job with services must also declare `network: bridge`.** Without it the service | ||
| 1015 | could only be reached by giving the job a network the workflow did not ask for, | ||
| 1016 | which is the promise `network: none` exists to keep. A push that declares services | ||
| 1017 | with `none` or with no `network:` is refused. A bridge job is already only leased to | ||
| 1018 | a runner that advertises bridge, so no new runner capability is involved. | ||
| 1019 | |||
| 1020 | The runner starts the services after the job image is resolved and before the first | ||
| 1021 | step. A service that is not running when the steps are about to start fails the job. | ||
| 1022 | There is no health check: a step that needs a server to accept connections waits for | ||
| 1023 | it, as `pg_isready` does in a postgres test. When the attempt fails, times out, or is | ||
| 1024 | canceled, the last 256 KiB of each service's output is added to the log under | ||
| 1025 | `=== service db ===`; a successful run does not carry it. The job stops first, then | ||
| 1026 | the services, then the network. A runner killed mid-job leaves all three behind, and | ||
| 1027 | its next start removes them by label. | ||
| 1028 | |||
| 1029 | | Constraint | Value | | ||
| 1030 | |---|---| | ||
| 1031 | | Maximum services per job | 3 | | ||
| 1032 | | Service name | `^[a-z][a-z0-9-]{0,31}$`, and the hostname a step uses | | ||
| 1033 | | Image | A registry reference, not `image-file:`. Pin it by digest for reproducibility. | | ||
| 1034 | | Environment | At most 64 entries; the same name, value, and one-line rules as a job's `env` | | ||
| 1035 | | Secrets | Not available to a service. A test credential is a literal in the workflow; a real one is for the job. | | ||
| 1036 | | Isolation | The job's user, user namespace, capabilities, and resource limits; `/tmp` is a writable tmpfs | | ||
| 1037 | |||
| 1038 | The service image must run as the job's uid. A database image that expects to start | ||
| 1039 | as root is not supported by this field; use an image that can run unprivileged, or | ||
| 1040 | point its data directory at `/tmp` as the postgres example does. The resource flags | ||
| 1041 | on `vole runner` apply to each container, so a job with services can use more than | ||
| 1042 | one container's limit. | ||
| 1043 | |||
| 1044 | #### `env` | ||
| 1045 | |||
| 1046 | Environment variables for every step of the job, on top of the image's own. Later | ||
| 1047 | values win, so a job can change something its image set: | ||
| 1048 | |||
| 1049 | ```yaml | ||
| 1050 | jobs: | ||
| 1051 | test: | ||
| 1052 | image: golang:1.27-bookworm | ||
| 1053 | env: | ||
| 1054 | GOCACHE: /cache/go-build | ||
| 1055 | GOFLAGS: "-mod=readonly" | ||
| 1056 | steps: | ||
| 1057 | - run: go test ./... | ||
| 1058 | ``` | ||
| 1059 | |||
| 1060 | | Constraint | Value | | ||
| 1061 | |---|---| | ||
| 1062 | | Maximum entries | 64 | | ||
| 1063 | | Key syntax | `^[A-Za-z_][A-Za-z0-9_]*$` | | ||
| 1064 | | Maximum value size | 8 KiB | | ||
| 1065 | | Line endings | Values must be one line; `CR`/`LF` are rejected | | ||
| 1066 | |||
| 1067 | `CI`, `VOLE_CI`, `GIT_TERMINAL_PROMPT`, `HOME` and `TMPDIR` are set by the runner and | ||
| 1068 | cannot be replaced: the sandbox depends on them, so the push that tries is refused | ||
| 1069 | rather than silently disagreeing with it. `VOLE_RUN_ID`, `VOLE_REPO`, | ||
| 1070 | `VOLE_SSH_COMMAND` and `VOLE_KNOWN_HOSTS` are reserved for the same reason: they point | ||
| 1071 | a job at its credential, and a workflow that could rewrite them could redirect the | ||
| 1072 | push. | ||
| 1073 | |||
| 1074 | This is how a job opts in to something the runner provides but does not decide for | ||
| 1075 | it. The job cache is the one that matters today: the runner mounts a directory at | ||
| 1076 | `/cache` and sets no variable for it, so pointing `GOCACHE` (or `CARGO_HOME`, or | ||
| 1077 | `npm_config_cache`) there is what makes the cache shared. See | ||
| 1078 | [Runners § Caching](runner.md#caching). | ||
| 1079 | |||
| 1080 | #### `secrets` | ||
| 1081 | |||
| 1082 | The repository secrets this job reads. Each entry is a name, never a value: the | ||
| 1083 | instance supplies the values when the job is leased, and the name is also the | ||
| 1084 | environment variable a step finds it in. One name may be written on its own: | ||
| 1085 | |||
| 1086 | ```yaml | ||
| 1087 | jobs: | ||
| 1088 | deploy: | ||
| 1089 | image: alpine:3.22 | ||
| 1090 | secrets: DEPLOY_KEY | ||
| 1091 | steps: | ||
| 1092 | - run: ./deploy.sh | ||
| 1093 | ``` | ||
| 1094 | |||
| 1095 | or as a list: | ||
| 1096 | |||
| 1097 | ```yaml | ||
| 1098 | secrets: [DEPLOY_KEY, REGISTRY_TOKEN] | ||
| 1099 | ``` | ||
| 1100 | |||
| 1101 | Names are upper-case letters, digits and `_`, at most 64 bytes, starting with a | ||
| 1102 | letter. A name that repeats another entry is refused, and so is one the runner sets | ||
| 1103 | itself (`CI`, `VOLE_CI`, `HOME`, `TMPDIR`, `GIT_TERMINAL_PROMPT`, and the | ||
| 1104 | `VOLE_EVENT*` variables). | ||
| 1105 | |||
| 1106 | A declared name the repository has no value for is not an error at push time and | ||
| 1107 | does not fail the job. The variable is left **unset** — a step can tell that apart | ||
| 1108 | from empty — and the runner writes one line to the log: | ||
| 1109 | |||
| 1110 | ``` | ||
| 1111 | vole: DEPLOY_TOKEN is not set for this repository, so this job runs without it. | ||
| 1112 | ``` | ||
| 1113 | |||
| 1114 | A step that requires one says so with the shell's own check: | ||
| 1115 | `: "${DEPLOY_TOKEN:?DEPLOY_TOKEN is not set}"`. | ||
| 1116 | |||
| 1117 | A value is at most 128 KiB, the kernel's limit for one `NAME=value` string in a | ||
| 1118 | process environment, and it is not part of the workflow, of any container argument, | ||
| 1119 | or of any run record. A record names the version of each value the job ran with. | ||
| 1120 | |||
| 1121 | The values reach the step through a file the runner writes into the run directory | ||
| 1122 | mounted at `/run/vole`, and the runner sources it before each step. There is no | ||
| 1123 | expressions layer: a value is a variable, and a step that builds a name at runtime | ||
| 1124 | reads the file itself. | ||
| 1125 | |||
| 1126 | The runner replaces each delivered value with `***` as the log is written, so a step | ||
| 1127 | that prints one by accident does not put it in the log the instance stores. This is | ||
| 1128 | best effort, and worth knowing exactly: | ||
| 1129 | |||
| 1130 | - a value that has been re-encoded — base64, hex, a URL escape, one field of a | ||
| 1131 | connection string — no longer matches, and is not masked; | ||
| 1132 | - a value shorter than 4 bytes is not masked at all, because replacing every | ||
| 1133 | occurrence of `1` or `yes` would rewrite the log and protect nothing; | ||
| 1134 | - an artifact, a site file or a release attachment is stored as the step wrote it, | ||
| 1135 | so a secret a step writes to a file it publishes is published. | ||
| 1136 | |||
| 1137 | #### `acts-as` | ||
| 1138 | |||
| 1139 | The bot account the job acts as: | ||
| 1140 | |||
| 1141 | ```yaml | ||
| 1142 | jobs: | ||
| 1143 | triage: | ||
| 1144 | image-file: agent | ||
| 1145 | acts-as: coding-agent | ||
| 1146 | steps: | ||
| 1147 | - run: vole issue comment "$ISSUE" --reply-to "$COMMENT" -F reply.md | ||
| 1148 | ``` | ||
| 1149 | |||
| 1150 | The account must be a bot account (see | ||
| 1151 | [Accounts and access § Bot accounts](accounts-and-access.md#bot-accounts)), and | ||
| 1152 | the instance issues the run a credential for it when the job is leased: a key | ||
| 1153 | generated for that run, written into the job, and gone when the run ends. The job | ||
| 1154 | inherits the account's role, so nothing here grants more than that account may do. | ||
| 1155 | |||
| 1156 | Two things change, and only two: | ||
| 1157 | |||
| 1158 | - writing to the issues branch no longer requires `maintainer`. What a job may write | ||
| 1159 | there is what its account may do, asked the same way the browser asks: an account | ||
| 1160 | that may discuss files an issue and comments, an author manages the item it wrote, | ||
| 1161 | a maintainer triages any of them, and an account that may approve may approve. The | ||
| 1162 | credential adds no rule of its own; it removes the one requirement that made every | ||
| 1163 | metadata write a maintainer's act; | ||
| 1164 | - the job can push to the instance without a long-lived key in a repository secret. | ||
| 1165 | The key is valid for this run, and a job whose account is retired or whose key has | ||
| 1166 | expired writes nothing. | ||
| 1167 | |||
| 1168 | The credential is a file, not a variable, and the runner points git at it, so a step | ||
| 1169 | does not need to know it exists: | ||
| 1170 | |||
| 1171 | | Variable | Value | | ||
| 1172 | |---|---| | ||
| 1173 | | `VOLE_RUN_ID` | The run this job is executing. | | ||
| 1174 | | `VOLE_REPO` | The repository, as the instance names it. | | ||
| 1175 | | `VOLE_SSH_COMMAND` | The ssh command that uses the run's key and known_hosts file. | | ||
| 1176 | | `VOLE_KNOWN_HOSTS` | The known_hosts file with this instance's host key. | | ||
| 1177 | |||
| 1178 | These four are set by the runner and cannot be replaced by the workflow's `env:`, | ||
| 1179 | the same rule as `CI` and `HOME`. A job that names no `acts-as` gets none of them and no | ||
| 1180 | credential, which is what every workflow had before this field existed. | ||
| 1181 | |||
| 1182 | #### `timeout` | ||
| 1183 | |||
| 1184 | A wall-clock budget for the job's steps, instead of a cap on each step separately: | ||
| 1185 | |||
| 1186 | ```yaml | ||
| 1187 | jobs: | ||
| 1188 | test: | ||
| 1189 | image: golang:1.27-bookworm | ||
| 1190 | timeout: 2h | ||
| 1191 | steps: | ||
| 1192 | - run: go test ./... | ||
| 1193 | - run: go vet ./... | ||
| 1194 | ``` | ||
| 1195 | |||
| 1196 | The budget starts with the first step and is spent in order. A step that declares its | ||
| 1197 | own `timeout:` is still cut short when the budget ends first, and a step that declares | ||
| 1198 | none runs with whatever is left, so one long step is enough to say: | ||
| 1199 | |||
| 1200 | ```yaml | ||
| 1201 | jobs: | ||
| 1202 | agent: | ||
| 1203 | image-file: agent | ||
| 1204 | timeout: 4h | ||
| 1205 | steps: | ||
| 1206 | - run: run-the-session | ||
| 1207 | ``` | ||
| 1208 | |||
| 1209 | When the budget is spent before a step starts, that step does not run and the job | ||
| 1210 | fails, with one line in the log saying so. The field is optional: without it each step | ||
| 1211 | is bounded by its own timeout, which is how a workflow worked before the field | ||
| 1212 | existed. | ||
| 1213 | |||
| 1214 | The image build is not part of the budget. It has its own cap, so a slow pull cannot | ||
| 1215 | eat the time the steps were given. | ||
| 1216 | |||
| 1217 | `timeout` is at most 4 hours, and a step whose own timeout is longer than the job's is | ||
| 1218 | refused at push time: the budget would end first, so the step could never use it. | ||
| 1219 | |||
| 1220 | #### `steps` | ||
| 1221 | |||
| 1222 | A non-empty list of shell steps, at most 100. Steps run in order. A step that exits | ||
| 1223 | non-zero stops the job and becomes the job's exit code. | ||
| 1224 | |||
| 1225 | Steps run inside the job's image, in the disposable checkout. They share the | ||
| 1226 | container and filesystem with the other steps in the same job. | ||
| 1227 | |||
| 1228 | ##### Step fields | ||
| 1229 | |||
| 1230 | | Field | Type | Required | Default | Meaning | | ||
| 1231 | |---|---|---|---|---| | ||
| 1232 | | `name` | string | no | first line of `run` | Display name in the log. | | ||
| 1233 | | `run` | string | yes | — | Shell command executed with `/bin/sh -c`. | | ||
| 1234 | | `timeout` | duration string | no | the job's remaining budget, or `10m` | Maximum time for this step. | | ||
| 1235 | |||
| 1236 | ```yaml | ||
| 1237 | steps: | ||
| 1238 | - name: test | ||
| 1239 | run: go test ./... | ||
| 1240 | timeout: 20m | ||
| 1241 | ``` | ||
| 1242 | |||
| 1243 | `run` is trimmed and must not be empty. The maximum size is 64 KiB. `name` is | ||
| 1244 | trimmed; when omitted it is derived from the first line of `run`, shortened to 60 | ||
| 1245 | characters. | ||
| 1246 | |||
| 1247 | `timeout` uses Go duration syntax (`90s`, `10m`, `1h`). It must be positive and no | ||
| 1248 | more than 4 hours, and it may not be longer than the job's own `timeout` when that is | ||
| 1249 | declared. When a step times out, the job fails and its container is stopped. | ||
| 1250 | |||
| 1251 | A step that declares no timeout of its own runs with the rest of the job's budget, | ||
| 1252 | or 10 minutes when the job has no budget. See the job's [`timeout`](#timeout), which is the budget the step runs inside. | ||
| 1253 | |||
| 1254 | #### `artifacts` | ||
| 1255 | |||
| 1256 | A list of file patterns to publish when the steps succeed. At most 32 declarations | ||
| 1257 | are allowed. | ||
| 1258 | |||
| 1259 | | Field | Type | Required | Default | Meaning | | ||
| 1260 | |---|---|---|---|---| | ||
| 1261 | | `path` | glob string | yes | — | Files to publish, relative to the checkout. | | ||
| 1262 | | `release` | boolean | no | `false` | Also attach the matches to the tag's release. | | ||
| 1263 | |||
| 1264 | ```yaml | ||
| 1265 | artifacts: | ||
| 1266 | - path: dist/* | ||
| 1267 | - path: dist/checksums.txt | ||
| 1268 | release: true | ||
| 1269 | ``` | ||
| 1270 | |||
| 1271 | `path` rules: | ||
| 1272 | |||
| 1273 | - Must be relative to the checkout; absolute paths and `..` segments are rejected. | ||
| 1274 | - Maximum 256 bytes. | ||
| 1275 | - May name a file, a directory, or a glob. A trailing `/` is rejected; write | ||
| 1276 | `dist`, not `dist/`. `.` is the checkout root and is refused. | ||
| 1277 | - A directory declaration publishes every regular file under it, relative to | ||
| 1278 | that directory: `dist/apt` publishes `Packages`, while `dist` publishes | ||
| 1279 | `apt/Packages`, `yum/repodata/repomd.xml`, and the flat files beside them. | ||
| 1280 | - A glob uses one-segment glob semantics. `dist/*` matches files directly in | ||
| 1281 | `dist/` but not files in `dist/sub/`. | ||
| 1282 | - `**` is rejected; use a directory declaration or more patterns. | ||
| 1283 | - A pattern that matches nothing fails the job. | ||
| 1284 | - A match from a glob is published under the path it has relative to the | ||
| 1285 | declaration's static root, which is the segments before the first glob. | ||
| 1286 | `dist/*` publishes base names, the behavior existing workflows use; `dist/*/*` | ||
| 1287 | keeps one directory level (`apt/Packages`); `dist/apt/*` publishes base names; | ||
| 1288 | a literal path publishes its base name. A directory declaration uses the | ||
| 1289 | directory itself as the root. The same paths are used for run downloads and | ||
| 1290 | release attachments. | ||
| 1291 | - Two matches that resolve to the same published path are refused because they | ||
| 1292 | would publish under one name. | ||
| 1293 | - A published path is slash-separated, at most 1024 bytes, and may not contain an | ||
| 1294 | empty segment, `.`, `..`, a backslash, or a control character. | ||
| 1295 | - `.git` is never published; symlinks and non-regular files are skipped. | ||
| 1296 | |||
| 1297 | `release: true` requires the workflow to declare `on.push.tags`. The job must run | ||
| 1298 | for an annotated tag; a branch run or a lightweight tag cannot publish a release. | ||
| 1299 | Release artifacts are attached to the tag's release in addition to being run | ||
| 1300 | artifacts. The runner must hold the `runner` role to upload artifacts and attach | ||
| 1301 | them to a release; maintainers and admins count implicitly. See | ||
| 1302 | [Releases](releases.md). | ||
| 1303 | |||
| 1304 | #### `pages` | ||
| 1305 | |||
| 1306 | Publishes one directory as the repository's website. | ||
| 1307 | |||
| 1308 | | Field | Type | Required | Default | Meaning | | ||
| 1309 | |---|---|---|---|---| | ||
| 1310 | | `path` | directory string | yes | — | Directory to publish, relative to the checkout. | | ||
| 1311 | |||
| 1312 | ```yaml | ||
| 1313 | pages: | ||
| 1314 | path: site/ | ||
| 1315 | ``` | ||
| 1316 | |||
| 1317 | `path` must be relative, at most 256 bytes, and must not climb out of the | ||
| 1318 | checkout with a `..` path segment or contain glob characters (`*`, `?`, `[`). A trailing `/` is accepted and trimmed. The directory | ||
| 1319 | is published after the steps pass, using the same rules as | ||
| 1320 | `vole pages deploy`. | ||
| 1321 | |||
| 1322 | Only one job in a workflow may declare `pages`. The target branch is set by the | ||
| 1323 | instance (`pages_ref`), not by the workflow. The deploy is refused if the run is no | ||
| 1324 | longer the newest commit on its branch. The runner must hold the `runner` role, | ||
| 1325 | which is what authorizes the push to the site branch; maintainers and admins are | ||
| 1326 | runners implicitly. See [Workflows § Publish a website](#publish-a-website). | ||
| 1327 | |||
| 1328 | ### Context and expressions | ||
| 1329 | |||
| 1330 | A workflow file is not a template. There is no `${{ }}` and no substitution in a | ||
| 1331 | step's `run`: `env` values are literal, a step executes the shell it is given, and | ||
| 1332 | everything the run knows arrives as an environment variable, a declared secret, or | ||
| 1333 | the event file. A manual input is read from the event file like any other event | ||
| 1334 | data: | ||
| 1335 | |||
| 1336 | ```yaml | ||
| 1337 | on: | ||
| 1338 | workflow-dispatch: | ||
| 1339 | inputs: | ||
| 1340 | environment: | ||
| 1341 | type: choice | ||
| 1342 | options: [staging, production] | ||
| 1343 | jobs: | ||
| 1344 | deploy: | ||
| 1345 | image: alpine:3.22 | ||
| 1346 | steps: | ||
| 1347 | - run: | | ||
| 1348 | environment="$(jq -r '.inputs.environment' "$VOLE_EVENT_PATH")" | ||
| 1349 | [ "$environment" = production ] || exit 0 | ||
| 1350 | ./deploy.sh | ||
| 1351 | ``` | ||
| 1352 | |||
| 1353 | `jq` is an example, not a dependency: the image is the dependency manifest, so | ||
| 1354 | install the JSON reader the step uses. | ||
| 1355 | |||
| 1356 | This is a decision, not an unfinished feature: | ||
| 1357 | |||
| 1358 | - The shell is already the expression language. A second one would mean two ways | ||
| 1359 | to write the same comparison, with its own parser, type rules, functions, and | ||
| 1360 | escaping, all validated on every push. | ||
| 1361 | - Event data is untrusted. A comment body, an issue title, or a manual input is | ||
| 1362 | text someone else wrote; substituting it into `run` would turn data into code. | ||
| 1363 | A file keeps it data, and the shell's quoting rules apply. | ||
| 1364 | - A secret is a value, not a name to build. It already arrives as an environment | ||
| 1365 | variable; an expression would invite it into a command line or a log line. | ||
| 1366 | - The parts of a workflow that usually need expressions — `if`, `needs`, matrix | ||
| 1367 | values, outputs — are not in the format. If they arrive, they can be typed | ||
| 1368 | fields with their own small, checkable rules instead of a general language. | ||
| 1369 | |||
| 1370 | ### What a workflow cannot express | ||
| 1371 | |||
| 1372 | The format deliberately supports push and event triggers with jobs of shell steps. | ||
| 1373 | It does not support: | ||
| 1374 | |||
| 1375 | - a job graph: there is no `needs`, no job outputs, and no shared artifacts between jobs | ||
| 1376 | - a build matrix or per-step conditions (`strategy`, `if`, `continue-on-error`) | ||
| 1377 | - step-scoped secrets, expressions for building a secret name, or a value written | ||
| 1378 | in the workflow file; secrets are job-scoped and the instance holds the values | ||
| 1379 | - expressions or `${{ }}` contexts; the shell is the expression language and the | ||
| 1380 | event file is the context. See [Context and expressions](#context-and-expressions). | ||
| 1381 | - cache keys, or artifact downloads between jobs | ||
| 1382 | - concurrency groups, or cancel-in-progress | ||
| 1383 | - workflow-level `env`, working directories, or shells; `env` is per job and every | ||
| 1384 | step runs through `/bin/sh -c` in the checkout | ||
| 1385 | - reusable workflows or composite actions (`uses:`); shell in an image is the | ||
| 1386 | reuse mechanism | ||
| 1387 | - environments, deployment approvals, per-job permissions, or OIDC | ||
| 1388 | - event payloads larger than 64 KiB; a long body is clipped in the pinned event | ||
| 1389 | |||
| 1390 | Combined results for a commit under review are still produced automatically by the | ||
| 1391 | server; `on.change-request` is the event trigger, not the combined-result scheduler. | ||
| 1392 | A local `vole workflow run` ignores triggers and `runs-on`, publishes no artifacts, | ||
| 1393 | deploys no site, and has no event payload. It applies a job's `network:` request, so a | ||
| 1394 | `bridge` job needs `--container-network bridge` here too, and it starts the job's | ||
| 1395 | services on the same kind of private network a runner would. It reads the secrets its | ||
| 1396 | jobs declare from the instance the checkout's remote names, and leaves the variables | ||
| 1397 | unset — with a note — where it cannot. | ||
| 1398 | |||
| 1399 | ### Validation and pinning | ||
| 1400 | |||
| 1401 | - The whole file is validated before a push is accepted. | ||
| 1402 | - Unknown keys are errors; use the field names on this page. | ||
| 1403 | - `version` must be `1`. | ||
| 1404 | - The commit, workflow blob, image definition, display names, descriptions, steps, | ||
| 1405 | environment, services, and artifact patterns are pinned when a run is queued. Later | ||
| 1406 | edits do not change that run. | ||
| 1407 | - `vole workflow check` and `vole workflow run` use the same validation as a push. | ||
| 1408 | A local run executes in the job's image and ignores `on.push` and `runs-on`; it does | ||
| 1409 | apply the job's `network:`, and refuses a `bridge` job when the run was started with | ||
| 1410 | `--container-network none`. | ||
| 1411 | |||
| 1412 | ### Complete example | ||
| 1413 | |||
| 1414 | ```yaml | ||
| 1415 | version: 1 | ||
| 1416 | name: Verify and release | ||
| 1417 | description: Test every matching push, then build a release from a version tag. | ||
| 1418 | on: | ||
| 1419 | push: | ||
| 1420 | branches: [main, "release/*"] | ||
| 1421 | tags: ["v*"] | ||
| 1422 | jobs: | ||
| 1423 | test: | ||
| 1424 | name: Unit tests | ||
| 1425 | description: Runs the test suite against the pinned toolchain. | ||
| 1426 | runs-on: [linux, arm64] | ||
| 1427 | image: golang:1.27-bookworm@sha256:... | ||
| 1428 | env: | ||
| 1429 | GOCACHE: /cache/go-build | ||
| 1430 | GOMODCACHE: /cache/go-mod | ||
| 1431 | steps: | ||
| 1432 | - name: unit tests | ||
| 1433 | run: go test ./... | ||
| 1434 | timeout: 20m | ||
| 1435 | artifacts: | ||
| 1436 | - path: coverage/* | ||
| 1437 | release: | ||
| 1438 | name: Build release | ||
| 1439 | runs-on: linux | ||
| 1440 | image-file: release-toolchain | ||
| 1441 | steps: | ||
| 1442 | - name: build | ||
| 1443 | run: make dist | ||
| 1444 | artifacts: | ||
| 1445 | - path: dist/* | ||
| 1446 | release: true | ||
| 1447 | ``` | ||
| 1448 | |||
| 1449 | ## Image reference | ||
| 1450 | |||
| 1451 | This section lists every field Vole accepts in a `.vole/images/*.yaml` | ||
| 1452 | definition, with its defaults and limits. Workflows reference the definition with | ||
| 1453 | `image-file`; the [job examples](#images) above show it in use. | ||
| 1454 | |||
| 1455 | Unknown keys are rejected. Every definition under `.vole/images/` is parsed when a | ||
| 1456 | workflow is pushed, even if no job references it, so a broken definition fails the | ||
| 1457 | push that introduced it. | ||
| 1458 | |||
| 1459 | ### Image file location and limits | ||
| 1460 | |||
| 1461 | | Item | Value | | ||
| 1462 | |---|---| | ||
| 1463 | | Location | Directly under `.vole/images/`; subdirectories are rejected | | ||
| 1464 | | Extension | `.yaml` or `.yml` | | ||
| 1465 | | Reference | `image-file: <name>`; the extension is optional in the reference | | ||
| 1466 | | Maximum file size | 64 KiB | | ||
| 1467 | | Schema version | `1` | | ||
| 1468 | | Maximum `env` entries | 64 | | ||
| 1469 | | Maximum `run` entries | 100 | | ||
| 1470 | | Maximum single command size | 64 KiB after trimming | | ||
| 1471 | | Maximum env value size | 8 KiB | | ||
| 1472 | |||
| 1473 | A definition is named by its filename without the extension: | ||
| 1474 | |||
| 1475 | ```text | ||
| 1476 | .vole/images/go.yaml -> image-file: go | ||
| 1477 | .vole/images/go.yml -> image-file: go | ||
| 1478 | .vole/images/release.yaml -> image-file: release | ||
| 1479 | ``` | ||
| 1480 | |||
| 1481 | Names are 1–64 characters: lowercase letters, digits, `.`, `_` and `-`, starting | ||
| 1482 | with a letter or digit. Two files for one name (`go.yaml` and `go.yml`) are | ||
| 1483 | rejected as ambiguous. | ||
| 1484 | |||
| 1485 | ### Image top-level fields | ||
| 1486 | |||
| 1487 | | Field | Type | Required | Default | Meaning | | ||
| 1488 | |---|---|---|---|---| | ||
| 1489 | | `version` | integer | yes | — | Schema version. Must be `1`. | | ||
| 1490 | | `from` | string | yes | — | Base OCI image. A tag works; a digest (`image@sha256:...`) makes the build reproducible. | | ||
| 1491 | | `env` | mapping | no | none | Environment variables set in the image. | | ||
| 1492 | | `run` | list of strings | no | none | Build commands, applied in order. | | ||
| 1493 | |||
| 1494 | ```yaml | ||
| 1495 | version: 1 | ||
| 1496 | from: golang:1.27-bookworm | ||
| 1497 | env: | ||
| 1498 | CGO_ENABLED: "0" | ||
| 1499 | run: | ||
| 1500 | - apt-get update && apt-get install -y --no-install-recommends jq | ||
| 1501 | - go install example.com/tool@v1.2.3 | ||
| 1502 | ``` | ||
| 1503 | |||
| 1504 | #### Image `version` | ||
| 1505 | |||
| 1506 | The only supported value is `1`: | ||
| 1507 | |||
| 1508 | ```yaml | ||
| 1509 | version: 1 | ||
| 1510 | ``` | ||
| 1511 | |||
| 1512 | #### Image `from` | ||
| 1513 | |||
| 1514 | The base image for the definition. It uses the same image-reference validation as | ||
| 1515 | `image:` in a workflow: | ||
| 1516 | |||
| 1517 | - Must be non-empty and at most 255 bytes. | ||
| 1518 | - Must start with a letter or digit. | ||
| 1519 | - May contain letters, digits, `.`, `_`, `/`, `:`, `@`, `+`, `~` and `-`. | ||
| 1520 | - A leading `-`, `..`, `://`, or a `file:` prefix is rejected. | ||
| 1521 | |||
| 1522 | ```yaml | ||
| 1523 | from: golang:1.27-bookworm@sha256:... | ||
| 1524 | ``` | ||
| 1525 | |||
| 1526 | Pin the base image by digest when reproducibility matters. A mutable tag can | ||
| 1527 | change what a later build produces. | ||
| 1528 | |||
| 1529 | #### Image `env` | ||
| 1530 | |||
| 1531 | A mapping of environment variable names to values, applied to the image: | ||
| 1532 | |||
| 1533 | ```yaml | ||
| 1534 | env: | ||
| 1535 | CGO_ENABLED: "0" | ||
| 1536 | MESSAGE: "hello world" | ||
| 1537 | ``` | ||
| 1538 | |||
| 1539 | | Constraint | Value | | ||
| 1540 | |---|---| | ||
| 1541 | | Maximum entries | 64 | | ||
| 1542 | | Key syntax | `^[A-Za-z_][A-Za-z0-9_]*$` | | ||
| 1543 | | Maximum value size | 8 KiB | | ||
| 1544 | | Line endings | Values must be one line; `CR`/`LF` are rejected | | ||
| 1545 | |||
| 1546 | Keys are emitted in sorted order, so the generated build is deterministic. | ||
| 1547 | |||
| 1548 | #### Image `run` | ||
| 1549 | |||
| 1550 | Build commands, run in order after `from` and `env`: | ||
| 1551 | |||
| 1552 | ```yaml | ||
| 1553 | run: | ||
| 1554 | - apt-get update && apt-get install -y --no-install-recommends jq | ||
| 1555 | - go install example.com/tool@v1.2.3 | ||
| 1556 | ``` | ||
| 1557 | |||
| 1558 | | Constraint | Value | | ||
| 1559 | |---|---| | ||
| 1560 | | Maximum entries | 100 | | ||
| 1561 | | Empty commands | Rejected | | ||
| 1562 | | Maximum size | 64 KiB after trimming | | ||
| 1563 | | Line endings | One line; `CR`/`LF` are rejected | | ||
| 1564 | | Shell | Each command runs through `/bin/sh -c` | | ||
| 1565 | |||
| 1566 | Chain commands with `&&` rather than using multiple lines: | ||
| 1567 | |||
| 1568 | ```yaml | ||
| 1569 | run: | ||
| 1570 | - apt-get update && apt-get install -y --no-install-recommends git make | ||
| 1571 | ``` | ||
| 1572 | |||
| 1573 | `run` entries are rendered as Dockerfile exec-form instructions: | ||
| 1574 | |||
| 1575 | ```dockerfile | ||
| 1576 | RUN ["/bin/sh", "-c", "apt-get update && apt-get install -y --no-install-recommends git make"] | ||
| 1577 | ``` | ||
| 1578 | |||
| 1579 | That keeps the first word of a command from being interpreted as a Dockerfile | ||
| 1580 | build flag such as `--network=host`. | ||
| 1581 | |||
| 1582 | ### What an image can and cannot express | ||
| 1583 | |||
| 1584 | The format deliberately supports only `from`, `env`, and `run`. It does not | ||
| 1585 | support: | ||
| 1586 | |||
| 1587 | - `COPY`, `ADD`, or a build context from the repository | ||
| 1588 | - multi-stage builds | ||
| 1589 | - `ARG` | ||
| 1590 | - `WORKDIR`, `USER`, `ENTRYPOINT`, `CMD`, `HEALTHCHECK`, or `SHELL` | ||
| 1591 | - build secrets or host mounts | ||
| 1592 | |||
| 1593 | The runner controls the job's working directory (`/workspace`), user, entrypoint, | ||
| 1594 | and mounts. The image supplies the toolchain and the shell. | ||
| 1595 | |||
| 1596 | The image build uses the runtime's default network. `--container-network` applies | ||
| 1597 | to the job container, not to the image build. The builder has no host mounts and | ||
| 1598 | no build secrets from Vole. | ||
| 1599 | |||
| 1600 | ### Image execution and caching | ||
| 1601 | |||
| 1602 | The runner renders the definition to a Dockerfile: | ||
| 1603 | |||
| 1604 | ```dockerfile | ||
| 1605 | FROM <from> | ||
| 1606 | ENV KEY="value" | ||
| 1607 | RUN ["/bin/sh", "-c", "<command>"] | ||
| 1608 | ... | ||
| 1609 | ``` | ||
| 1610 | |||
| 1611 | It builds that image with the configured OCI runtime and tags it by the SHA-256 of | ||
| 1612 | the exact definition file. A later job with the same definition reuses the tag. | ||
| 1613 | `--container-pull always` rebuilds a custom image even when the tag exists. | ||
| 1614 | |||
| 1615 | An image definition is code: its build runs on the runner through the OCI builder, | ||
| 1616 | so approving a contributor tip that changes a definition also approves that build. | ||
| 1617 | Use rootless Podman where possible. | ||
| 1618 | |||
| 1619 | The resulting job image must contain `/bin/sh` and a POSIX `sleep`, because Vole | ||
| 1620 | runs each step with `/bin/sh -c` and keeps the container alive between steps. If | ||
| 1621 | `run` is non-empty, the base image used for `from` must also provide `/bin/sh`, | ||
| 1622 | because build commands are rendered that way. | ||
| 1623 | |||
| 1624 | Nothing a job writes inside the container survives the run, except what it puts in | ||
| 1625 | the cache: the runner mounts a directory at `/cache` and sets no variables for it, | ||
| 1626 | so `env` is where a definition opts in. Point the toolchain's own variables at it | ||
| 1627 | and its downloads are reused between jobs: | ||
| 1628 | |||
| 1629 | ```yaml | ||
| 1630 | env: | ||
| 1631 | GOMODCACHE: "/cache/go-mod" | ||
| 1632 | GOCACHE: "/cache/go-build" | ||
| 1633 | ``` | ||
| 1634 | |||
| 1635 | A job may also set its own `env`, which is applied after the image's and wins; it | ||
| 1636 | is the way to point at `/cache` when the image is a registry reference rather than a | ||
| 1637 | definition. `/tmp` is a memory-backed tmpfs and `HOME` points there for everything | ||
| 1638 | else; the XDG convention (`XDG_CACHE_HOME: /cache/xdg`) covers tools that follow it. | ||
| 1639 | See [Runners § Caching](runner.md#caching). | ||
| 1640 | Check that anything calling `getpwuid` has a passwd entry for the uid the job runs | ||
| 1641 | as — see [Runners § How a job runs](runner.md#how-a-job-runs). | ||
| 1642 | |||
| 1643 | ### Image validation and pinning | ||
| 1644 | |||
| 1645 | - `version` must be `1`. | ||
| 1646 | - Unknown keys are errors. | ||
| 1647 | - The definition must live directly under `.vole/images/`, not in a subdirectory. | ||
| 1648 | - Both `.yaml` and `.yml` are accepted, but not two files for the same name. | ||
| 1649 | - Every definition is parsed at push time, even if unreferenced. | ||
| 1650 | - The exact definition text and its digest are pinned with each run. | ||
| 1651 | - `--container-pull always` rebuilds instead of reusing the digest tag. | ||
| 1652 | |||
| 1653 | ### Image complete example | ||
| 1654 | |||
| 1655 | ```yaml | ||
| 1656 | # .vole/images/release-toolchain.yaml | ||
| 1657 | version: 1 | ||
| 1658 | from: golang:1.27-bookworm@sha256:... | ||
| 1659 | env: | ||
| 1660 | CGO_ENABLED: "0" | ||
| 1661 | SOURCE_DATE_EPOCH: "0" | ||
| 1662 | run: | ||
| 1663 | - apt-get update && apt-get install -y --no-install-recommends git make jq | ||
| 1664 | - go install example.com/release-tool@v1.4.0 | ||
| 1665 | ``` | ||
| 1666 | |||
| 1667 | ```yaml | ||
| 1668 | # .vole/workflows/release.yaml | ||
| 1669 | version: 1 | ||
| 1670 | on: | ||
| 1671 | push: | ||
| 1672 | tags: ["v*"] | ||
| 1673 | jobs: | ||
| 1674 | release: | ||
| 1675 | runs-on: [linux, amd64] | ||
| 1676 | image-file: release-toolchain | ||
| 1677 | steps: | ||
| 1678 | - name: build | ||
| 1679 | run: make dist | ||
| 1680 | artifacts: | ||
| 1681 | - path: dist/* | ||
| 1682 | release: true | ||
| 1683 | ``` | ||
| 405 | 1684 | ||
| 406 | 1685 | ## Next | |
| 407 | 1686 | ||
| 408 | - [Workflow reference](reference/workflow-reference.md) — every field, trigger, | ||
| 409 | default, and limit. | ||
| 410 | - [Set up a runner](deploy/runner.md) — provide a machine that can lease jobs. | ||
| 411 | - [Runner reference](runner.md) — isolation, caching, logs, and scheduling. | ||
| 1687 | - [Set up a runner](deploy/linux.md#set-up-a-runner-on-linux) — provide a machine that can lease jobs. | ||
| 1688 | - [Runners](runner.md) — registration, isolation, caching, logs, and scheduling. | ||