For the complete documentation index, see llms.txt. This page is also available as Markdown.

Template

A Template stage applies a pre-built stage definition from the Harness template library, inheriting all steps and settings defined in the template.

A Template stage applies a saved stage template from the Harness template library. Instead of configuring a stage from scratch, you select a template and the stage inherits all of its steps, runtime settings, inputs, and execution controls. Any change to the template propagates to all pipelines that use it after reconciliation.

What you will learn

  • What a Template stage is and how it inherits steps and settings from a saved template

  • How to add a template stage and fill in its runtime inputs

  • How to manage, version, and update templates from the template library

When to use template stages

  • Your team has standardized build, test, or deploy workflows that should be reused across pipelines

  • You want to enforce consistency: all pipelines use the same security scan, approval gate, or artifact publish pattern

  • You need to update a common stage definition in one place and have it reflect everywhere

How template stages work

  1. When you add a stage and select Template, Harness opens the template library.

  2. You browse or search for a stage template and select a version.

  3. The stage is created with all the steps and settings defined in the template. Template-managed fields are locked for editing in the pipeline unless the template marks them as runtime inputs.

  4. You fill in any runtime inputs the template exposes (for example, a target environment or image tag).

Template inputs

Templates can mark specific fields as runtime inputs using <+input>. When you add a template stage to a pipeline, you supply values for those fields either inline (fixed values) or leave them as runtime inputs to be provided when the pipeline runs.

Manage templates

Templates are versioned and can be stored inline or in a remote Git repository. Go to Templates to find documentation on:

  • Creating and publishing stage templates

  • Versioning and stable vs. latest references

  • Reconciling pipelines when a template changes

  • Remote templates stored in Git

https://github.com/harness/harness-developer-hub/tree/main/3k-docs/platform/harness-platform-resources/templates/README.md

Next steps

  • Go to Stage overview to understand how stages work and how to add them to a pipeline.

  • Go to Templates to create, version, and manage stage templates.

Last updated

Was this helpful?