branchd Docs

Presets

Get a whole set of standard jobs from a preset, configure it under with:, and add jobs of your own that wait for its jobs.

Updated 2026-12-04presets.mdEdit this page

Available in repositories branchd reads pipeline files for. It is switching repositories on one at a time: until yours is, it keeps running its .forge-ci.yaml or .xeonr-ci.yaml. See What is available.

.branchd/pipelines/ci.yaml
# .branchd/pipelines/ci.yaml
# The service preset tests and builds the api app. This file's own job
# waits for the preset's build job and reads its image output.
name: CI
preset:
  uses: branchd/presets/service@v1
  with:
    apps:
      api:
        type: k8s
        test:
          image: golang:1.26
          command: go vet ./... && go test -race -count=1 ./...
        build: {image: api}
jobs:
  smoke:
    needs: [preset.apps.api.build]
    image: ${{ needs.preset.apps.api.build.outputs.image }}
    steps:
      - run: /app/server --version
  • preset: is {uses, with}. uses names the preset, <group>/<repo>[/<path>]@<version>, by repository and version as other repositories are named; with is its configuration. A file has at most one.
  • Finding one. Every published preset you can use is in Steps & presets.
  • Where presets come from. Another repository, which lists the preset's path in its .branchd/packages.yaml and holds the built module at <path>/preset.wasm at the tagged commit. Who may use it is that repository's visibility, as for steps: a private repository's preset only by itself. uses: ./<path>, a preset of the same repository, is refused for now.
  • branchd's own presets (cli, library, mobile, npm, proto, service) are one repository each in the branchd/presets group, each written, built and released on its own: write branchd/presets/<preset>@v1. Their old addresses (xeonr/forge/presets/<preset>, branchd/presets-legacy/<preset>) are retired.
  • Steps inside a preset. A preset names each typed step it uses at an exact release of its repository, never @v1, so a new step release reaches a preset's jobs only through a new preset release. Your own jobs beside the preset may use branchd/steps/<family>/<step>@v1.
  • Trust. A preset's jobs run with your repository's full context: they may name any of its secrets, set environments, start triggers and ask for runner labels, as your own jobs may. Pin a version you trust. To narrow what it may use, give preset: any of secrets: [...], allow: [environment, trigger], runs-on: [...] and permissions: {...}. The module itself never sees a secret's value.
  • Optional permissions. A preset job may ask for a permission it can do without. It gets it only as far as the preset: block's permissions: grants it, else the file's top-level permissions:, else the default (contents: read); short of that the job runs with less, and nothing is refused.
  • A preset is a program that reads with: and the run's facts and returns ordinary jobs. branchd runs it when the run is compiled, so branchd ci plan lists its jobs with yours.
  • Addresses. Each preset job is at the path of the configuration that made it, under preset.: preset.apps.api.test, preset.apps.api.build. A prefix is a group: needs: [preset.apps.api] waits for every job of that app that runs, and needs: [preset] for the whole preset.
  • A need on one preset job that does not run for this event is refused, unless it is optional: true. A need on an address the preset does not produce is refused, and the message lists the addresses it does.
  • Outputs. A job that needs a preset job reads ${{ needs.preset.<address>.outputs.<name> }}; any job that waits for it, directly or through other jobs, can read ${{ preset.<address>.outputs.<name> }}.
  • Nothing patches a preset's job. Your jobs sit beside them. A change to a preset's job is a change to with:; if the preset has no setting for it, it is added to the preset.
  • on: is optional. Without it, the preset's own triggers apply. With it, the file runs when both match; an event the preset never runs on is refused.
  • Your own job ids may not start with preset..

The service preset

branchd/presets/service tests, builds, migrates and deploys Kubernetes services and the node app types, and takes the keys .xeonr-ci.yaml takes. Its jobs:

AddressJob
test, apps.<name>.testThe repository's and each app's tests
lint.golangcigolangci-lint
commits.lintThe commit subject check
migrations.check, migrations.<env>Strata migration check and migration
buf.check, apps.<name>.generatebuf check or generation
apps.<name>.retain, apps.<name>.buildRetained assets; the image (outputs image, tag, digest)
apps.<name>.public, apps.<name>.release, apps.<name>.release-platformsThe public image copy; the released binary
gitops.<env>The environment's deploy commit
lantern.lint, lantern.applyLantern declarations
docsThe documentation site's build
installThe node apps' dependency install
apps.<name>.checkA renderer or upl-im app's development build, on branches other than prod and stage
apps.<name>.build, apps.<name>.build.<env>, apps.<name>.build.linux, .win, .macA cf-worker's build; a renderer's build per environment; an electron app's build per platform
apps.<name>.deploy.<env>, apps.<name>.publish.<env>A cf-worker, renderer or electron app's deploy or publish; an upl-im app's publish
helm.<name>.lint, helm.<name>.publishEach chart's lint and render on every run; its publish from the prod and stage branches

The gitops.<env> jobs ask for contents: write as an optional permission, for the deploy commit. Grant it with permissions: {contents: write} under preset: (or, when preset: sets no permissions:, at the top of the file); without it they get the token the file grants (see Optional permissions above).

Its app types are k8s, cf-worker, renderer, electron and upl-im; cli, npm, library, proto and mobile are presets of their own (branchd/presets/<name>@v1), and the service preset refuses them with a message saying so. See Coming from .xeonr-ci.yaml.