A run spec is the same everywhere: in the API's spec, a template, a .forge/ run file and a
flow step. The API takes JSON, files take YAML with the same keys. Unknown fields are refused.
For what each part is for, see run specs.
The run
| Field |
Type |
Meaning |
type |
string |
Empty or container for a container; vm for a virtual machine of its own; compose for a compose file in a VM. |
image |
string |
The image to run. alpine means docker.io/library/alpine:latest. Not for compose. |
command |
list of strings |
Replaces the image's entrypoint. |
args |
list of strings |
Replaces the image's command. |
commands |
list |
Scripts run one after another instead of command and args; see commands. |
shell |
list of strings |
The shell each command runs under. Default ["/bin/sh", "-e", "-c"]. Only with commands. |
env |
map |
Environment variables. Values may refer to the project's variables as ${NAME}. |
working_dir |
string |
The directory the run starts in. |
compose |
string |
A compose run's compose file. |
exit_from |
string |
A compose run's service whose exit ends the run and gives its exit code. |
init |
string |
A vm run: forge (default) starts the command itself; image boots the image's own init, such as systemd, first. |
Resources and time
| Field |
Type |
Meaning |
resources |
object |
cpu_millis (1000 is one core), memory_bytes, disk_bytes (the scratch space reserved on the runner). Default 1 core, 512 MiB memory and 10 GiB disk. |
timeouts |
object |
In seconds: queue_seconds (waiting for a runner), pull_seconds, start_seconds, checkout_seconds, run_seconds (the process itself), stop_grace_seconds (between the stop signal and the kill), cache_seconds. |
Where it runs
| Field |
Type |
Meaning |
labels |
map |
Labels a runner must have, such as gpu: "true" or group: ci. |
class |
string |
The runner class of the shared runners it may use. Default: the project's, else the platform's. |
concurrency |
object |
group (may use ${git.*} and ${env.NAME}) and policy: queue (default), cancel_in_progress or skip. One run of a group is active at a time. |
environment |
object |
name of the project's environment it deploys to, and an optional url. The environment's rules apply. |
Secrets, images and tokens
| Field |
Type |
Meaning |
secrets |
map |
The secrets the run gets, by name: {} as an environment variable, { file: /path } as a file. The project's, else the organization's. |
registry |
string |
The image registry whose pull login pulls the image. Without it the image is pulled anonymously. |
push |
list |
Images to push once the run succeeds: registry, from (an OCI layout or tarball in the run's files), image (the repository), tags. |
id_tokens |
map |
OIDC tokens, by name, each with an audience; see OIDC tokens. |
Files
| Field |
Type |
Meaning |
artifacts |
list |
Paths saved when the run ends: path, and optionally expire_in_days. A string alone is a path. |
outputs |
list |
The old name of artifacts, still accepted. A run's key and value outputs are written to $FORGE_OUTPUT instead. |
caches |
list |
Directories restored before the run and saved after it: key, restore_keys, paths, policy (pull-push, pull or push) and save (on_success or always). See caches. |
reports |
object |
Test reports to read: junit (paths or globs) and coverage. |
checkout |
object or false |
How a run with Git context checks out its commit: depth, submodules, lfs, sparse, fetch_tags, path and extra repositories. false skips it. |
services |
map |
Companion containers by name; see services. |
Commands
Each entry of commands:
| Field |
Meaning |
name |
Letters, digits, - and _, unique in the run. Default: its position. |
run |
The script, up to 32 KiB; all of them together up to 48 KiB. |
timeout_seconds |
The command's own limit, within run_seconds. |
env |
Added to the environment for this command only. |
always |
Run it even after an earlier command failed. |
Services
Each entry of services, up to 8:
| Field |
Meaning |
image, command, args, env, working_dir, resources, secrets, registry |
As for the run. |
ready |
When the service is ready: port accepts connections, or command exits 0; timeout_seconds to wait. |
Run files
A run file under .forge/ has the spec's fields plus:
| Field |
Meaning |
version |
Required, 1. |
name |
The run's name. |
retry |
max_attempts (1 to 10), initial_delay_seconds, max_delay_seconds, and on: any of failed, timed_out, lost, pull_failed. |