Overview
Blocks are the interactive components of a runbook.mdx file. Write them as JSX tags within your markdown.
Available blocks
Section titled “Available blocks”These are all the blocks a runbook can use. A component that isn’t listed here, such as <Tabs>, fails to render.
Collect input and generate files
Section titled “Collect input and generate files”<Inputs>renders a form whose values other blocks use in their scripts, templates and props.<Template>generates files from a Boilerplate template directory, with a form for the template’s variables.<TemplateInline>renders a Boilerplate template written in the runbook itself and shows the result inline.<DirPicker>selects a directory path with a cascading set of dropdowns.
Run scripts
Section titled “Run scripts”<Command>runs a shell command or script that changes state, such as a deployment.<Check>runs a shell command or script that reports whether the user’s system is in the expected state.<Prerequisites>checks that the tools the runbook needs are installed, at the versions it needs, and says how to install the ones that aren’t.<Finish>marks the end of the runbook. It can run a final check, then shows your next steps.
Authenticate
Section titled “Authenticate”<AwsAuth>signs in to AWS with static credentials, AWS SSO, or a local AWS profile.<GoogleAuth>signs in to Google Cloud with a service account key, a Google sign-in, or a gcloud configuration.<AzureAuth>signs in to Azure with the Azure CLI, a device code, or a service principal.<GitAuth>signs in to GitHub or GitLab, chosen from a dropdown.<GitHubAuth>is<GitAuth>locked to GitHub.<GitLabAuth>is<GitAuth>locked to GitLab.
Work with git repositories
Section titled “Work with git repositories”<GitClone>clones a git repository, or uses a checkout the user already has on disk.<GitPullRequest>commits the changes in a cloned repository and opens a GitHub pull request or a GitLab merge request.<GitHubPullRequest>is<GitPullRequest>locked to GitHub.<GitLabMergeRequest>is<GitPullRequest>locked to GitLab.
Show content
Section titled “Show content”<Admonition>renders a note, info, warning, or danger callout.<Chapter>splits a long runbook into chapters, shown one at a time with a table of contents.<ShowWhen>shows its content only while another block’s output has a given value, such as the GitHub or GitLab steps after a<GitAuth>.<Iframe>embeds a web page: an external site, or an HTML page from the runbook’sassets/folder.
Block IDs
Section titled “Block IDs”Interactive blocks take an id prop, a unique identifier for the block. When one block references another, it does so by the other block’s ID:
inputsIduses the values collected by an<Inputs>or<Template>block. See Wiring blocks withinputsId.awsAuthId,azureAuthId,googleAuthId,gitAuthIdandgithubAuthIdchoose which auth block’s credentials a block uses.dependsOnnames the<Command>or<Check>blocks that must succeed before a<Command>,<Check>or<Finish>can run. A<Check>that ends with a warning counts too. See Run order.showWhenBlockshows a<Command>,<Check>or<Finish>only while another block’s latest run ended a certain way. See Showing a block after another one fails.<ShowWhen output="<block_id>.<OUTPUT_NAME>">shows its content only while another block’s output has a given value. See<ShowWhen>.gitCloneIdroots a<DirPicker>in the repository a<GitClone>block cloned.{{ .outputs.<block_id>.<output_name> }}reads the outputs of a block that has already run. In template syntax, write any hyphens in the ID as underscores. See Block outputs.
Each ID must be unique within a runbook. IDs that differ only in hyphens versus underscores (such as create-account and create_account) count as the same ID.
Runbook tests use IDs too: each step in runbook_test.yml names the block it runs by its ID. See Testing.
In Runbooks, most blocks show a small ID badge in their top-right corner. <TemplateInline> doesn’t, and neither does an <Inputs> block nested inside another block. Hover over the badge (or Tab to it) to see the block’s ID, and click it to copy the ID to your clipboard.
Progress
Section titled “Progress”The title bar shows how far through the runbook the user is: a bar along its bottom edge fills in, and a count next to the session name, such as “2 of 5 steps done”, says how many steps are done. A window narrower than 1024 pixels shows only the bar.
Each block the user acts on is a step. It is done once the block shows it’s done, and stops being done if the block goes back:
| Block | Done when |
|---|---|
<Command> |
Its last run succeeded. |
<Check> |
Its last run succeeded, or ended with a warning, which also lets the blocks that depend on it run. |
<Prerequisites> |
Its last check found every required tool. A missing optional tool doesn’t matter. |
<Finish> |
The runbook is finished. A final check that ends with a warning leaves it unfinished. |
<Inputs> |
Its form was submitted, and is green. |
<Template> |
Its files were generated, and its form is green. |
<AwsAuth>, <GoogleAuth>, <GitAuth>, <GitHubAuth> and <GitLabAuth> |
It is signed in, and green: credentials that expire within five minutes turn it red. |
<AzureAuth> |
It is signed in. |
<GitClone> |
It cloned or found its repository, which is still on the session’s branch. |
<GitPullRequest>, <GitHubPullRequest> and <GitLabMergeRequest> |
It opened its pull or merge request. |
<DirPicker> |
It has a path. |
<TemplateInline>, <Admonition>, <Chapter>, <ShowWhen> and <Iframe> aren’t steps, as there is nothing in them for the user to do. The blocks inside a <Chapter> are steps as they would be anywhere else, and its table of contents counts them per chapter. The blocks inside a <ShowWhen> are steps only while its content shows. Neither is an <Inputs> nested in a <Command> or <Check>, which is part of that block, nor a block that shows a configuration error, such as a duplicate ID, in its place.
A resumed session brings the blocks back as the user left them, so their steps are done as they were. In instruction mode, a step is done once the user marks it as done.
Folding done blocks
Section titled “Folding done blocks”A block that the user acts on once and then doesn’t need to look at again, such as a <Command> that installs tools or a sign-in, can fold out of the way once it’s done. Set autoCollapse on it:
<Command id="install-tools" title="Install the tools" command="brew bundle" autoCollapse />Once the block is done, as in the Progress table, it folds down to its title: its status icon, title and ID badge stay where they were, and the rest is hidden. Click anywhere on it to show the block in full, and the arrow beside its ID badge to fold it again. A <Command> or <Check> without a title shows its command, or its script’s path, in place of one.
The block folds each time it becomes done, such as when a run succeeds again, and shows in full whenever it isn’t done, such as a sign-in whose credentials are about to expire. A resumed session brings its done blocks back folded. Folding only hides a block: its logs, outputs and values stay as they were, for the blocks that use them.
autoCollapse works on <Command>, <Check>, <Prerequisites>, <AwsAuth>, <GoogleAuth>, <AzureAuth>, <GitAuth>, <GitHubAuth>, <GitLabAuth>, <GitClone>, <GitPullRequest>, <GitHubPullRequest> and <GitLabMergeRequest>. In instruction mode, these blocks fold once the user marks them as done.