Skip to the content
Forge

Run specs

A run spec describes one run. The console's New run form, templates, run files in your repository, flow steps and the API all make the same spec.

image: golang:1.24
working_dir: /src
env:
  GOFLAGS: -mod=mod
secrets:
  DEPLOY_TOKEN: {}          # as env; { file: /run/secrets/deploy } for a file
resources: { cpu_millis: 2000, memory_bytes: 4294967296 }
timeouts: { run_seconds: 1800 }
commands:
  - name: test
    run: go test ./...
  - name: report
    run: cat report.txt
    always: true

The main parts

  • image: the container image to run, and optionally the registry to pull it from with a login.
  • commands: the scripts to run, one after another. Or command and args, to run the image's own program.
  • env: the environment. Values can refer to the project's variables as ${NAME}.
  • secrets: the project's secrets the run gets, as environment variables or files. Secrets never show in the output.
  • resources: the CPU and memory the run may use.
  • timeouts: how long it may wait and run.
  • labels: which runners may take it.
  • services: companion containers, see services.
  • artifacts, caches and outputs: what it keeps and passes on.

A spec can also say to retry the run, to push images it built, which environment it deploys to, or to run as a whole virtual machine instead of a container.

Where specs live

  • Typed in the console, for one run.
  • Saved as a template, to start again with parameters.
  • In your repository as .forge/run.yaml, started by a trigger when you push.
  • As a step of a flow.