Customize Task Overview with Templates
This guide shows you how to use ConfigMap-backed templates to render rich HTML reports in the Overview tab for your TaskRuns and PipelineRuns.
Instead of writing a full HTML or Markdown report into a single Task result, your Tasks emit small structured metrics, and the UI uses a template from a ConfigMap to render the final overview.
Use this guide when:
- You want a consistent, polished overview for a
Task(for example, a code scan summary). - Your Markdown overview is close to or beyond the effective size limit of a
Taskresult. - You want to re-use the same layout across many
Tasksor clusters.
Template rendering is an alternative to overview-markdown. If a
Taskstill outputs a result namedoverview-markdown, the UI will prefer that Markdown and skip template rendering.
TOC
PrerequisitesHow it worksSteps1. Choose between Markdown and templates2. Create a template ConfigMap3. Add a result to your Task4. Annotate the Task to bind it to the template5. Run the Task and check the Overview tabTips and conventionsTroubleshootingNothing appears in the Overview tabTemplate renders but data is empty or wrongResult size or termination message limitsWrong template is pickedPrerequisites
- Tekton Pipelines installed on your cluster.
- Permissions to create ConfigMaps in the shared template namespace
kube-public.
How it works
- Your
Taskemits one or more results that contain metrics or summary data. - Your
Taskmetadata includes annotations that tell the UI:- Which ConfigMap should be used as the template (via a label selector).
- Which
Taskresults should be read and passed into the template.
- The UI:
- Checks whether the
TaskRunhas a result namedoverview-markdown. If yes, it renders that Markdown and stops. - Otherwise, reads the template annotations from the
TaskRun. - Finds a matching ConfigMap and loads
template.ejs. - Reads the declared results from the
TaskRunand merges them into a single JSON payload. - Evaluates the EJS template with that payload and renders the generated HTML in the Overview tab.
- Checks whether the
Steps
1. Choose between Markdown and templates
Use overview-markdown result when:
- The content is short and easy to keep under the result-size limits.
- You only need very simple formatting.
Use a template ConfigMap when:
- You want more complex layout (columns, badges, progress bars, etc.).
- You already have structured metrics and want a nicer presentation.
- You want one overview layout to be shared by multiple
Tasks.
If both paths are configured,
overview-markdownwins. You can view the template output simply by not writing anything tooverview-markdownresult.
2. Create a template ConfigMap
Create a ConfigMap that contains your EJS template and labels that identify which Task it belongs to.
EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain JavaScript. For more details, see:
Example:
Key points:
- The template filename is always
template.ejs. - The UI will inject variables from results into the template.
- You can use normal EJS syntax (
<% %>,<%= %>) for simple logic and formatting.
3. Add a result to your Task
Define a result on your Task that will carry the metrics used by the template.
Example Task:
Guidelines:
- Keep the result small and flat. Use simple fields like counts, percentages, status, and URLs.
- Do not embed huge text blobs.
- If you use object result, ensure the step writes valid JSON (no trailing commas, correct quoting).
4. Annotate the Task to bind it to the template
Use annotations on the Task to tell the UI which template to use and which results to pass into it.
Single-result example:
Conceptually, the UI will construct a payload like:
Then it evaluates template.ejs with that payload so you can use metrics.total, metrics.status, and so on.
You can combine multiple Task results into one template rendering. This is useful when:
- One result holds metrics.
- Another result holds a URL to a full report.
Example:
The UI will build a payload similar to:
5. Run the Task and check the Overview tab
-
Apply the
ConfigMapandTaskto your cluster. -
Create a
TaskRunorPipelineRunthat uses theTask, for example: -
Wait for the run to complete.
-
Open the run in the UI and select the Overview tab.
If everything is wired correctly, you should see the HTML produced by your template.
If the
Taskalso emitsoverview-markdown, the Markdown will be shown instead of the template.
Tips and conventions
- Prefer small metrics result. Treat results as a compact summary.
- Keep template logic simple. Focus on presentation, not business logic. Avoid heavy computations in the template.
- Handle missing data defensively. Use default values in the template so missing fields do not crash rendering.
Troubleshooting
Nothing appears in the Overview tab
- Does the
Taskemit emptyoverview-markdown?- If yes, the UI will show that empty Markdown and ignore templates. You can view the template output simply by not writing anything to
overview-markdownresult.
- If yes, the UI will show that empty Markdown and ignore templates. You can view the template output simply by not writing anything to
- Does the
TaskRuncontain the result(s) listed inoverview-template-result-key?- Inspect the
TaskRunYAML and check.status.results.
- Inspect the
- Does the selector in
overview-template-selectormatch exactly oneConfigMapinkube-publicnamespace?- Test it with
kubectl get configmap -l <your-selector> -n kube-public.
- Test it with
Template renders but data is empty or wrong
- If you are using object result, confirm the result is valid and contains the fields your template expects.
- Check that
overview-template-result-keynames match theTaskresult names exactly.
Result size or termination message limits
- Remove non-essential fields from your results.
- Push detailed per-file reports to logs or an external system, and include only summary numbers and URLs in the result.
- Remember that each
Taskstill shares a single termination-message budget across all steps and results. - Modify result limit
Wrong template is picked
- Ensure
overview-template-selectoris specific enough (for example, include bothTaskname and version). - Avoid reusing the same labels for unrelated templates.
- If multiple
ConfigMapsmatch the selector, tighten the labels so only oneConfigMapis selected.
Once you have a template ConfigMap, metric results, and the correct Task annotations, you can build reusable, versioned Task overview layouts without modifying the UI itself.