Runner and PlugsHow-to guides
Pass outputs between plugs
Give a plug an id and read what it published from the inputs of the plugs after it.
A plug can publish named string values with ctx.setOutput. The plugs listed after it read them as
${{ setup.<id>.outputs.<name> }}, so the plug that publishes needs an id.
Read an output in a later plug
blaise:git/worktree publishes the path and branch of the worktree it creates. Use them in a
later plug:
version: 1
setup:
- id: checkout
use: blaise:git/worktree
- use: blaise:env
with:
vars:
WORKTREE: ${{ setup.checkout.outputs.path }}
BRANCH: ${{ setup.checkout.outputs.branch }}Publish an output from a script
With blaise:shell, append name=value lines to the file in $BLAISE_OUTPUT:
- id: database
use: blaise:shell
with:
start: |
docker compose up -d db
echo "url=postgres://localhost:5432/app" >> "$BLAISE_OUTPUT"
- use: blaise:env
with:
vars:
DATABASE_URL: ${{ setup.database.outputs.url }}Things to know
- A plug can only read the outputs of plugs before it. A reference to a later or unknown id is an error when the configuration loads.
- A plug's
with:is evaluated when the plug before it callsnext(), so it sees outputs published by every plug that already ran. - Outputs are strings. Nothing is stored between runs: a plug re-publishes its outputs on every run
(a
resumescript repeats whatstartpublished, often through a YAML anchor). - A plug that is skipped in a run publishes nothing. In a teardown that happens later, the plugs
that only have an
onSessiondo not run, so their outputs are empty there.