# CI forge runs CI workflows defined in `.forge/ci.toml` at the root of a repository. Jobs run on separate **runners**, which are `forge runner` on machines you control. The forge never connects to a runner. Runners pull jobs over HTTPS. What v1 has: jobs with `needs`, secrets, artifacts, a build cache, live logs, commit statuses, and manual, push, tag and pull request triggers. What it does not have: YAML. The workflow file is TOML. Jobs run in a rootless sandbox, with no container tool needed. The runner pulls and unpacks the image itself, and runs each job in its own container built with libcontainer, the crate behind youki. Each job gets its own container, its own workspace, and a read-only token. Podman is still supported as an option (`executor = "podman"`). ## Format reference The file is limited to 64 KiB. Parsing is forward-compatible: an unknown key at any level (top level, `[on]`, `[jobs.]`, `[release]`) is ignored, not rejected, so a `ci.toml` that uses a newer feature still runs on an older forge. The run page shows the ignored keys in a warning banner, and the run's jobs get a `[forge] warning: unknown key ...` line at the start of their logs. For example `on.schedule` is not supported and shows up this way. Known keys keep full validation: their types, globs, limits and other checks still make the file an error. A file with a parse error still creates a run, in state `error`, with the message shown on the run page and a `ci/config` status set to `error`. ### Top level | Key | Type | Default | Meaning | |--------|--------|---------|---------| | `name` | string | none | The workflow's name, used as the label of the [status badge](#status-badge). 1 to 40 characters after trimming, no control characters. | ### `[on]` | Key | Type | Default | Meaning | |----------------|-----------------|---------|---------| | `push` | array of string | `[]` | Branch globs. A push to a matching `refs/heads/*` starts a run. | | `tags` | array of string | `[]` | Tag globs. A push of a matching `refs/tags/*` starts a run. | | `pull_request` | bool | `false` | Start a run when a pull request is opened, updated or reopened. The config is read at the **head** commit. | | `manual` | bool | `true` | Writers can start a run on an existing branch from the CI tab. | | `cancel_superseded` | bool | `true` | A push to a branch cancels the queued and running runs for older commits on that branch (see [Superseded runs](#superseded-runs)). | | `schedule` | array of string | `[]` | Cron expressions (5 fields, UTC). See [Scheduled runs](#scheduled-runs). Max 8. | | `merge_queue` | bool | `false` | Run the workflow on each merge queue candidate of a branch that requires the queue. Without it, a candidate runs the `push` jobs of its target branch. See [Merge queue](merge-queue.md). | ### `[jobs.]` There must be at least one job, and at most 20. | Key | Type | Default | Rules | |-------------------|----------------------|---------|-------| | `image` | string | none | Required. Non-empty, no whitespace. Image reference, pulled by the runner. | | `run` | string | none | Required. Non-empty. Runs as `sh -eu -c ""` in `/workspace`. | | `needs` | array of string | `[]` | Job names that must succeed first. Must exist. No cycles. | | `secrets` | array of string | `[]` | Repo secret names, each `^[A-Z_][A-Z0-9_]{0,63}$`. Exported as env vars. | | `env` | table of string | `{}` | Plain env vars. Names match the same pattern. A secret with the same name wins. | | `artifacts` | array of string | `[]` | Relative globs in the workspace. No `..`, no leading `/`. | | `runs_on` | array of string | `[]` | Runner labels. Every label must be present on the runner. | | `cache` | array of string | `[]` | Workspace-relative directories to keep between runs. Max 8. See [Cache](#cache). | | `timeout_minutes` | integer | `60` | Range 1 to 360. | | `memory` | string | none | The job's expected peak memory, such as `4g` or `512m`. 64m to 1024g. See [Memory](#memory). | | `matrix` | table | none | Expands the job into one job per combination. See [Matrix builds](#matrix-builds). | | `network` | bool | `true` | `false` gives the job an empty network namespace (loopback only). `true` shares the runner host's network namespace. Read [the caveats](#builtin-executor-caveats). | Job names match `^[a-z0-9][a-z0-9_-]{0,39}$`. The job's workspace is a fresh checkout of the exact commit, at `/workspace`. The job starts in that directory. ### Memory `memory` is optional. You do not need it: the runner reacts to real memory use instead of trusting a number. When you set it, it is a hint for admission and an explicit cap for the job. ```toml [jobs.build] image = "docker.io/library/rust:1" run = "cargo build --release" memory = "4g" # optional ``` What the runner does without it: - Optimistic admission. A job without `memory` reserves the runner's default (`limits.reserve_memory`, 1g unless an admin changed it) and may use up to the whole memory budget of the runner. The runner tells the forge how much memory its box has left with every claim, and the forge hands out the first queued job whose reservation fits. A smaller job may run before a bigger one that has to wait. To keep the big job from starving, a job that does not fit and has waited 5 minutes stops smaller jobs from passing it on that runner. A job that asks for more than the runner's whole budget runs alone. - Pause and park. The runner puts all job cgroups in one box (`forge-jobs`) capped at the memory budget. When two or more jobs run and the box nears its cap, the runner freezes the youngest job and pushes its memory to swap, and logs `runner: paused: memory pressure, waiting for ` and `runner: parked MiB in swap` in that job. The older job keeps its RAM and finishes. The parked job thaws when the box has room for what is in its swap or nothing else runs, and logs `runner: resumed after