Skip to the content
Forge

Flows

A flow is a YAML file of stages, each with steps. Every step is a run. The steps of a stage run at the same time; the next stage starts when they have ended.

version: 1
stages:
  - name: build
    steps:
      - name: compile
        image: golang:1.24
        command: [make, build]
        artifacts: [/workspace/bin]
  - name: test
    steps:
      - name: unit
        needs: [compile]
        image: golang:1.24
        command: [make, test]

What a step can do

  • needs: start as soon as the steps it needs have ended, without waiting for the whole stage, and get their artifacts.
  • if: run only when a condition holds, such as the branch being main, or only after a failure.
  • template: run one of the project's templates with parameters.
  • matrix: run once for each combination of values, such as several language versions.
  • retry and allow_failure: try again, or let the flow go on after a failure.
  • approval: wait for a person to approve before the flow goes on.

Running a flow

Start a flow from the console, with forge flow run FILE, from the API, or with a Git trigger on a flow file in your repository. The flow's page shows each stage and step as it goes, and lets you re-run the failed steps. The console's flow builder edits the same file visually.