Step and package files
The keys of a step.yaml (composite and typed) and of .branchd/packages.yaml.
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.yamlor.xeonr-ci.yaml. See What is available.
step.yaml: a composite step
In .branchd/steps/<name>/step.yaml of your repository (used as ./<name>),
or in any listed directory of a publishing repository (used as
<group>/<repo>/<path>@<version>).
# .branchd/steps/setup-buf/step.yaml
# A composite step: steps with inputs, expanded into the job that uses it.
name: Set up buf
description: Installs buf, and signs in to the Buf Schema Registry when asked.
inputs:
version: {type: string, default: '1.56.0'}
login: {type: bool, default: 'false'}
secrets:
BUF_TOKEN: {required: false, description: 'A Buf Schema Registry token, for login.'}
outputs:
path: ${{ steps.install.outputs.path }}
steps:
- id: install
name: Install
run: |
curl -fsSLo /usr/local/bin/buf \
"https://github.com/bufbuild/buf/releases/download/v${{ inputs.version }}/buf-$(uname -s)-$(uname -m)"
chmod +x /usr/local/bin/buf
echo "path=/usr/local/bin/buf" >> "$BRANCHD_OUTPUT"
- name: Sign in
if: inputs.login
run: echo "$BUF_TOKEN" | buf registry login buf.build --token-stdin
| Key | Takes | Meaning |
|---|---|---|
name | string | Prefixes its steps' labels in the log. Default: the directory's name. |
description | string | For people. |
inputs | map of names to {type, default, required, description} | type: string (default), bool or int. An input not given reads its default, else '', false or 0. |
secrets | map of names to {required, description} | Secrets it reads from the environment. The job that uses it grants them; a required one it does not grant is refused. |
outputs | map of names to a value, or {value, description} | Usually ${{ steps.<id>.outputs.<name> }} of one of its steps. |
steps | list of steps | Required, at least one: run: steps and other composite steps, with the step keys. A typed step (ci/…) is refused here. |
A step.yaml with a binary step's keys is refused where a composite step is
expected.
step.yaml: a typed step
A typed step is one program that branchd runs in its own image (or, with
runs.kind: binary, among a job's run: lines). It is written as manifest
version 2: manifest: 2. Its registry name comes from the repository and
the directory it is published from, so the file names none; other
repositories use it as <team>/<repo>/<dir>@<version>. See
Writing a step for publishing.
# steps/hello/step.yaml
# A typed step (manifest v2): one program, built from the Go main package in
# this directory, run in its own image. Its registry name comes from the
# repository and directory, so the file names none.
manifest: 2
name: Hello
description: Greets someone and says how long the greeting was.
runs:
main: .
platforms: [linux/amd64, linux/arm64]
source: true
inputs:
who:
type: string
default: world
description: Who to greet.
outputs:
length:
type: int
description: The greeting's length in bytes.
secrets:
GREETING_TOKEN:
optional: true
description: Not needed to greet; shown here to declare a secret.
The step
| Key | Takes | Meaning |
|---|---|---|
manifest | 2 | Required for every key below. A file without it is the older form (package, main, platforms, image at the top level), still read. |
name | string | Required. Shown in the step gallery and the run plan. |
description | string | At most 1,024 characters. |
readme | path | A Markdown file beside step.yaml, shown in the gallery. |
deprecated | string | A message printed as a note on every use. |
How it runs
| Key | Takes | Meaning |
|---|---|---|
runs.main | path | The Go main package to build, relative to the directory (it may be ../cmd/x, inside the repository). Or: |
runs.binaries | map of platforms to paths | Prebuilt programs. |
runs.args | list of strings | Arguments after the program on its command line, so one program can be several steps. |
runs.platforms | list | linux/amd64 (default), linux/arm64, darwin/arm64, … |
runs.image | {base} | The image the program is added to, by digest. Default: a minimal non-root image. |
runs.kind | image (default) or binary | binary: per-platform programs that can also run inline among a job's run: lines, and on a host. |
runs.host | bool | It can run in a host: true job. |
source | bool | It takes the checkout as its source input. |
no_repository_code | bool | With source: it runs none of the repository's code. |
git | {history, tags, refs, submodules} | What it needs of the checkout: history is full, none or a depth; tags: true fetches tags; refs lists more refs, default_branch or refs/…. |
uninterruptible | bool | A newer run never interrupts a job running it, and cancel-in-progress on such a job is refused. |
lock | string | The lock its job takes when the job names none; {<input>} is replaced by that input's value. |
capabilities | list | What it needs of its sandbox: services, and network, privileged or host_runtime, which the repository's step grant must allow. |
runner | {labels, ignore_labels} | labels: the runner labels its job asks for when the job names none. ignore_labels: older labels a job may still name for it, accepted and dropped. |
env | {job_variables, reserved} | job_variables: true passes the job's variables to its env input; reserved lists further names (or prefixes ending _) dropped from it. |
Inputs and outputs
| Key | Takes | Meaning |
|---|---|---|
inputs | map of names to {type, default, required, description, literal, platform, destination} | type: string, int, bool, duration, list, map, object or blob (no default). env and source are reserved names. |
inputs.<name>.literal | bool | A pipeline file must give a literal value, known at compile time. Required of any input a when or lock reads. |
inputs.<name>.platform | rollback or {remote: {of: <input>}} | Only branchd sets it; a pipeline file that does is refused. rollback: set on a rollback run of the step. remote: the off-branchd remote of the repository another input names, when its owner has recorded one. |
inputs.<name>.destination | map | Where the step may send a credential with this value; any other value is refused at compile and again when it runs. hosts: host names (*. matches one or more labels) a URL may be on; forge: true: branchd's own hosts; paths: true: the URL may have a path; version: true: x.y.z, a leading v, or latest; any: true: anywhere, and the step then gets no secret its job does not list; list: {url: <field>}: the value is a list of objects whose field holds the URL; match: each named field of a list item must match a pattern. An address-like input (url, *_url, registry, host, …) without one cannot be set by a file. |
outputs | map of names to {type, required, description, attest} | type: string, int, bool, json or blob. Required unless required: false. attest: true carries the value, signed, in the identity token of every job that needs this one. |
Secrets and credentials
| Key | Takes | Meaning |
|---|---|---|
secrets | map of names to {required, optional, file, description, when, required_when} | required: granted without the job listing it. optional: the step works without it. file: delivered as a file. when: the declaration applies only while a condition on its inputs holds. required_when: required only while it holds. |
when, required_when | {input, set}, {input, equals} or {input, in}, or a list (all of them) | The input must be literal or platform. |
accepts_any_secret | bool | It takes the secrets its job lists beyond those declared; each secret's own limits decide. Needs the repository's step grant. |
credentials | list of {application, scope, env, resources, when, replaces, drops, signal} | A token for one Xeonr product, exchanged from the job's identity: application (required) names the product; scope what it asks for; env the variables it is written to; resources narrows it from inputs ({input, type}); replaces lists stored secrets it stands in for (a job that grants one uses it instead); drops lists grants dropped when it is used; signal: true tells the step which audience it was given. |
branchd and delivery
| Key | Takes | Meaning |
|---|---|---|
forge | {identity, permissions, push_to} | identity: the branchd surfaces its job token reaches (git, api, registry, modules); permissions: what its job token must be able to do, in permissions: names; push_to: the input naming another repository it pushes to, allowed only where that repository's owner granted it. |
delivery | {role, environment, apps, target, report, rollback} | What it does for a run's delivery. role: migrate, rollout, after or check. environment, target: {input} naming the input that holds it. apps: {input, field}, the list a rollout moves and the field naming each app. report: {output}, a check's output shown on the pull request. rollback: {inputs}, what a rollback run of a rollout sets. |
Unknown keys are refused.
.branchd/packages.yaml
In a repository whose steps or pipelines other repositories use. Read at the head of its default branch.
# xeonr/forge/steps: .branchd/packages.yaml
# What other repositories may use from xeonr/forge/steps. It is read at the head
# of the default branch, never at the commit being used.
packages:
- setup-buf
- .branchd/pipelines/deploy.yaml
| Key | Takes | Meaning |
|---|---|---|
packages | list of paths | Step directories (holding step.yaml) and pipeline files (declaring on: call) other repositories may use, by path from the repository's root. Required. |