Skip to the content
Forge

Runs, logs and artifacts

A run is one container or VM doing one job. This guide covers starting runs, following them, and what they leave behind: artifacts (files), outputs (short values) and summaries (Markdown). It also covers commands, cancelling, keeping, retries, timeouts and concurrency groups.

Start a run

In the console, open the project and choose New run. Fill in an Image and either a Command or one or more Commands, then choose Start run. As an API request shows the same run as a request you can send yourself.

From the command line (see the command line):

forge run alpine:3.22 echo hello                  # arguments replace the image's command
forge run --cmd 'go mod download' --cmd 'go test ./...' golang:1.24
forge run --file run.json                         # a request as the console shows it
forge run --template build --param target=staging # one of the project's templates
forge run -d alpine:3.22 sleep 60                 # only start it and print its id

Other flags set the run's resources (--cpu, --memory, --disk), env (--env NAME=value), secrets (--secret NAME), artifacts (--artifact PATH) and more. Run forge run -h for all of them.

From the API, POST /api/v1/projects/{project}/runs with {"name": "…", "spec": {…}}. An Idempotency-Key header makes it safe to send the same request again: you get the run created the first time instead of a second one. See service accounts and API keys for a token.

Follow it

forge run follows the output until the run ends and exits with the run's exit code: 124 when it timed out, 130 when it was cancelled and 125 when Forge itself couldn't do it. Ctrl-C stops following, not the run. To come back to it:

forge logs RUN        # the output so far
forge logs -f RUN     # follow until it ends
forge wait RUN        # wait for the end; exits with the run's code

The run page shows the state, the output as it is written, and the CPU, memory, disk and network the run uses. Download log saves the whole output. History lists each state change. Lines between ::group::Title and ::endgroup:: fold under the title on the page.

Commands

commands runs several scripts one after another in the same container, each with its own section in the log:

image: golang:1.24
commands:
  - name: test
    run: go test ./... | tee report.txt
    timeout_seconds: 600
  - name: report
    run: cat report.txt
    always: true
  • A failing command skips the ones after it, except those with always: true. The run fails with the first failed command's exit code.
  • timeout_seconds is the command's own limit, within the run's. env adds variables for that command only.
  • shell is the run's shell for every script. The default is /bin/sh -e -c, which stops a script at its first failing line.
  • A run has commands or command and args, not both. Compose runs can't have commands.
  • At most 50 commands, 32 KiB a script and 48 KiB for all of them.

To hand a value to the commands after this one, write NAME=value lines to $FORGE_ENV:

echo "VERSION=$(git describe --tags)" >> "$FORGE_ENV"

Artifacts

Artifacts are files a run keeps for you to download, or for the next step of a flow. List absolute paths in the spec:

artifacts:
  - /workspace/dist
  - { path: /workspace/coverage.html, expire_in_days: 7 }
  • They are collected once the process has ended, whatever its result, so a failed run's files are there too. A directory is packed as .tar.gz.
  • At most 32 paths. They can't be below /proc, /sys, /dev or /run.
  • expire_in_days (1 to 365) deletes that artifact sooner than the rest of the run's data. In the form, add the days after the path: /workspace/dist 7d.

The run page's Artifacts card lists each path with its size and status (Stored, Not found, Too large or Failed) and a download link. The API has GET /api/v1/runs/{run}/artifacts and …/artifacts/{artifact}/download.

Outputs

Outputs are short text values, such as a version or an image digest. Write NAME=value lines to $FORGE_OUTPUT:

echo "version=$(git describe --tags)" >> "$FORGE_OUTPUT"
{ echo "notes<<EOF"; cat notes.txt; echo "EOF"; } >> "$FORGE_OUTPUT"   # several lines

They are read when the run ends, whatever its state, and show in the run page's Outputs card. A later flow step can use them. At most 50 outputs, 4 KiB a value and 32 KiB in all; one over a limit is left out with a note. An output that holds one of the run's secrets is left out too. Outputs are stored as plain text, so don't use them for secrets.

forge outputs RUN            # all of them, as NAME=value lines
forge outputs RUN version    # one value, for scripts
forge outputs --json RUN

Summaries

Markdown written to $FORGE_SUMMARY becomes the run's Summary card, above the output, and part of the GitHub check for runs from a Git trigger. It can be at most 1 MiB and is masked like the log. Headings, emphasis, code, links, lists, quotes and tables are shown. Raw HTML shows as text and images aren't loaded.

Compose runs have no $FORGE_OUTPUT or $FORGE_SUMMARY.

Cancel a run

Cancel run on the run page, forge cancel RUN or POST /api/v1/runs/{run}/cancel. A run that is still queued ends at once. A running one gets SIGTERM, then SIGKILL after its stop grace (timeouts.stop_grace_seconds, 10 seconds by default).

Keep a run

Ended runs are deleted with their output and artifacts after the organization's retention. Keep run on the run page, or forge keep RUN, keeps an ended run until you choose Stop keeping (forge unkeep RUN). Kept runs count against the organization's quota for kept runs.

Retries

A template or a flow step can have a retry policy: up to 10 attempts, a wait that doubles from a first to a longest wait, and the ways of ending that start again: failed, timed_out, lost (the default) and pull_failed. Each attempt is a new run with the same spec, variables and secret versions; the run page shows "Attempt n of m" and links them. Cancelled runs never retry, and Cancel retry stops a pending one.

Timeouts

In timeouts What it limits Default At most
queue_seconds waiting for a runner 5 min 24 h
pull_seconds pulling the image 15 min 1 h
start_seconds starting the container or VM 2 min 15 min
checkout_seconds checking out the commit 10 min 1 h
run_seconds the process itself 1 h 24 h
stop_grace_seconds between SIGTERM and SIGKILL 10 s 5 min

In the form these are Time limit (minutes) and Runner wait (minutes); with forge run, --timeout 30m and --queue-timeout 1h.

Concurrency groups

A concurrency group lets only one of the project's runs in the group be active at a time, for example a deploy that mustn't overlap with itself:

concurrency:
  group: deploy-${env.TARGET}-${git.branch}
  policy: queue        # or cancel_in_progress, or skip
  • queue (the default): a new run waits as Waiting until the earlier ones have ended.
  • cancel_in_progress: a new run cancels the active ones and waits until they have stopped.
  • skip: no new run is created while one is active. A trigger or schedule records the fire as skipped, and a flow step is skipped.

The group can use ${git.…} fields, ${env.NAME} from the spec's own env, and in templates ${params.NAME}. Retries keep their group and wait their turn. In the form, the group and the policy are under Advanced.