BlaiseBlaise
Documentation
Runner and PlugsHow-to guides

Share configuration between files with !include

Reuse plugs across repositories and build variants of a configuration.

!include replaces a node with the contents of another YAML file. The path is resolved relative to the file that contains the tag.

Reuse a list of plugs

Put the plugs in a file that contains a sequence:

blaise/node-project.yml
- use: blaise:shell
  with:
    start: bun install --frozen-lockfile

- use: blaise:shell
  with:
    start: bun run build

Include it where the plugs should run. A sequence included in a sequence is spliced in place, so the file contributes several plugs:

blaise.yml
version: 1
setup:
  - use: blaise:env
    with:
      files: [.env.agent]
  - !include ./blaise/node-project.yml

An included mapping becomes a single item.

Make a variant of a configuration

Merge a base file and replace only what differs. Keys in the including mapping win:

blaise.docker.yml
<<: !include ./blaise.yml
setup:
  - use: blaise:docker
    with:
      image: buildpack-deps:bookworm
  - !include ./blaise/node-project.yml

Select the variant with --config blaise.docker.yml.

Things to know

  • Each file is its own YAML document, so anchors do not cross files. Repeat the value in the included file, or pass it through a plug input.
  • use: ./plug.ts in an included file is relative to that file, not to the including file.
  • Includes nest. A cycle is an error that names the chain of files.
  • Hidden keys (.name) hold anchors in the file that defines them. See the configuration reference.

On this page