Skip to Content
Xeonr Developer Docs
Pipelines

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.

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.

Not yet available (xeonr/forge/presets): the shared preset repository has released v1 (tags v1.0.0 and v1.0.1) but is still private, visible only to its own team, until its visibility is set to organisation. The examples use xeonr/forge/presets/service@v1; until then, that reference is refused from any other repository. A preset in a repository of your own company works today if that repository's visibility is company or organisation: a private repository's preset is usable by that repository alone.

.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: xeonr/forge/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.
  • 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.
  • 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.
  • 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

xeonr/forge/presets/service tests, builds, migrates and deploys Kubernetes services, 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

It ports the k8s app type first; the other types are refused for now, each with a message saying so. See Coming from .xeonr-ci.yaml.

On this page