Skip to content

feat: show template prerequisites in builder UI#26523

Open
jeremyruppel wants to merge 1 commit into
jeremy/devex-287-be-base-variable-renderingfrom
jeremy/devex-446-show-template-prerequisites-in-advance-in-ui
Open

feat: show template prerequisites in builder UI#26523
jeremyruppel wants to merge 1 commit into
jeremy/devex-287-be-base-variable-renderingfrom
jeremy/devex-446-show-template-prerequisites-in-advance-in-ui

Conversation

@jeremyruppel

@jeremyruppel jeremyruppel commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Surface base template prerequisites to admins before they create a template in the Template Builder wizard.

Today, template prerequisites (Docker socket setup, Kubernetes auth, AWS IAM policies) are only visible in the registry README after import. Admins hit opaque provisioner errors and have to hunt for docs. This change extracts the prerequisites from the README and serves them via the API so the frontend can display them inline.

How it works

Each base template README uses HTML comment markers (<!-- prerequisites:start --> / <!-- prerequisites:end -->) to delimit the prerequisites section. At boot time, the base catalog loader reads the README, extracts the content between markers via strings.Index, and caches both the full README and the prerequisites string.

The prerequisites are served via a new prerequisites field on GET /api/v2/templatebuilder/bases. The full README is included in the composed template tar bundle and stored as the template version readme.

Changes

  • Add README.md with prerequisite markers to coderd/templatebuilder/bases/{docker,kubernetes,aws-linux}/
  • New ExtractPrerequisites() in prerequisites.go using literal string matching
  • bases.go: load README at boot, fail loudly if missing, extract prerequisites
  • compose.go: include README in ComposeResult and tar bundle
  • codersdk: add Prerequisites field to TemplateBuilderBase
  • Handler: populate prerequisites in bases response, set readme on template version
Implementation notes
  • Prerequisites extraction uses strings.Index for exact literal marker matching; no regex or AST parser needed since we control the markers.
  • YAML frontmatter is deliberately retained in the stored README. The frontend TemplateDocsPage already strips it at render time via front-matter.
  • The prerequisite markers are HTML comments, invisible in rendered markdown.
  • The RejectsMissingReadme test enforces that every base template must include a README.
  • AWS Linux prerequisites span two H2 sections (## Prerequisites and ## Required permissions / policy), which is why heading-based parsing was rejected in favor of explicit markers.

Generated with the assistance of an AI coding agent. Reviewed by @jeremyruppel.

Relates to https://linear.app/codercom/issue/DEVEX-446

…mplates

Add README.md files to each base template directory (docker, kubernetes,
aws-linux) with HTML comment markers (<!-- prerequisites:start --> and
<!-- prerequisites:end -->) to delimit the prerequisites section.

At boot time, the base catalog loader reads the README and extracts the
prerequisites content between the markers using simple string literal
matching. This content is served via a new 'prerequisites' field on the
GET /api/v2/templatebuilder/bases response.

The full README is also included in the composed template tar bundle
(README.md) and set on the template version row, so builder-created
templates have proper documentation visible in the Coder UI.

Part of DEVEX-446
@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

DEVEX-446

@github-actions

Copy link
Copy Markdown

Docs preview

📖 View docs preview for docs/reference/api/schemas.md

@datadog-coder

This comment has been minimized.

@jeremyruppel jeremyruppel force-pushed the jeremy/devex-446-show-template-prerequisites-in-advance-in-ui branch from dcbc7b1 to 8560438 Compare June 18, 2026 15:24

Provision AWS EC2 VMs as [Coder workspaces](https://coder.com/docs/user-guides/workspace-management) with this example template.

<!-- prerequisites:start -->

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are the markers that need to be added by hand to each README that has prerequisites

Comment on lines +119 to +123
readmeData, err := fs.ReadFile(baseFS, "README.md")
if err != nil {
return nil, xerrors.Errorf("read README.md for base %q: %w", manifest.ID, err)
}
readme := string(readmeData)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base templates should always have a README file, which may or may not contain prerequisites

@jeremyruppel jeremyruppel changed the title feat(coderd/templatebuilder): show template prerequisites in builder UI feat: show template prerequisites in builder UI Jun 18, 2026
Comment on lines +108 to +114
t.Run("KnownBasesHaveReadme", func(t *testing.T) {
t.Parallel()
for _, id := range templatebuilder.BaseTemplateIDs() {
readme := templatebuilder.BaseReadme(id)
require.NotEmpty(t, readme, "base %q should have a README", id)
}
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the is the test-time check for READMEs in each base template; the embed time check will also fail if no README is present in the base template directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant