|
| 1 | +--- |
| 2 | +weight: 10 |
| 3 | +i18n: |
| 4 | + title: |
| 5 | + en: Output Markdown to the Overview Tab (PipelineRuns & TaskRuns) |
| 6 | + zh: 输出 Markdown 到 Overview 标签(PipelineRuns & TaskRuns) |
| 7 | +title: Output Markdown to the Overview Tab (PipelineRuns & TaskRuns) |
| 8 | +--- |
| 9 | + |
| 10 | +# Output Markdown to the Overview Tab (PipelineRuns & TaskRuns) |
| 11 | + |
| 12 | +This guide shows you how to surface human‑readable reports in the **Overview** tab of both **PipelineRuns** and **TaskRuns** by writing Markdown into a Task **Result** named `overview-markdown`. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +- **Tekton Pipelines** installed on your cluster. |
| 17 | +- **Optional but recommended:** **Tekton Results** deployed so your summaries remain queryable even after old TaskRuns/PipelineRuns are garbage‑collected. |
| 18 | + |
| 19 | +> Why Tekton Results? If your cluster prunes runs aggressively, the in‑cluster TaskRun/PipelineRun objects (and their results) may disappear. Tekton Results provides a central store so historical Overview reports remain accessible. |
| 20 | +
|
| 21 | +## How it works |
| 22 | + |
| 23 | +- The UI reads a Task's **result** with the **exact name** `overview-markdown`. |
| 24 | +- Whatever Markdown you write into that result file will be rendered in the run's **Overview** tab. |
| 25 | +- In a Pipeline, **each Task** can produce its own `overview-markdown`, and the Overview tab shows them grouped by Task. |
| 26 | +- You **do not** need to write to a **Pipeline** result for the Overview tab; write to the **Task's** `overview-markdown` instead. |
| 27 | + |
| 28 | +> **Limits:** A single Task's result value is limited to **4 KB** by default. Keep summaries concise; link out to larger artifacts when needed. If you want to configure the result size limit, you can refer to [Result Limit Exceeded When Writing Tekton Task Results](../trouble_shooting/result-limit-exceeded.mdx). |
| 29 | +
|
| 30 | +## Steps |
| 31 | + |
| 32 | +### 1. Define a Task result named `overview-markdown` |
| 33 | + |
| 34 | +Create (or update) your Task so it declares a string result with that exact name. |
| 35 | + |
| 36 | +In one of the Task's steps, write Markdown to `$(results.overview-markdown.path)`. |
| 37 | + |
| 38 | +Example Task (replace `<image>` as needed): |
| 39 | + |
| 40 | +```yaml |
| 41 | +apiVersion: tekton.dev/v1 |
| 42 | +kind: Task |
| 43 | +metadata: |
| 44 | + name: demo-markdown-overview |
| 45 | +spec: |
| 46 | + results: |
| 47 | + - name: overview-markdown |
| 48 | + description: "Markdown content displayed in the Overview tab." |
| 49 | + type: string |
| 50 | + steps: |
| 51 | + - name: write-markdown |
| 52 | + image: <image> |
| 53 | + script: | |
| 54 | + #!/bin/bash |
| 55 | + # Write Markdown to the result path. |
| 56 | + cat >"$(results.overview-markdown.path)" <<'EOF' |
| 57 | + # Demo Overview |
| 58 | +
|
| 59 | + **Status:** ✅ Success |
| 60 | +
|
| 61 | + **Artifacts** |
| 62 | + - Image: `ghcr.io/example/app:v1.2.3` |
| 63 | + - SBOM: `sbom.spdx.json` |
| 64 | +
|
| 65 | + **Notes** |
| 66 | + - Lint passed. |
| 67 | + - 0 critical vulnerabilities found. |
| 68 | +
|
| 69 | + _Generated by **demo-markdown-overview**._ |
| 70 | + EOF |
| 71 | +``` |
| 72 | +
|
| 73 | +Keep the Markdown short and focused. A single Task's result value is limited to **4 KB** by default. For long reports: |
| 74 | +
|
| 75 | +- Upload the full artifact (e.g., HTML, JSON, PDF) to your storage or artifact repository. |
| 76 | +- Put a link in the Markdown (e.g., `[Full report](https://artifact.example.com/run/123/report.html)`). |
| 77 | + |
| 78 | +If you want to configure the result size limit, you can refer to [Result Limit Exceeded When Writing Tekton Task Results](../trouble_shooting/result-limit-exceeded.mdx). |
| 79 | + |
| 80 | +### 2. Run the Task |
| 81 | + |
| 82 | +Create a TaskRun referencing your Task, wait for it to complete. |
| 83 | + |
| 84 | +Example TaskRun: |
| 85 | + |
| 86 | +```yaml |
| 87 | +apiVersion: tekton.dev/v1 |
| 88 | +kind: TaskRun |
| 89 | +metadata: |
| 90 | + name: demo-markdown-overview-run |
| 91 | +spec: |
| 92 | + taskRef: |
| 93 | + name: demo-markdown-overview |
| 94 | +``` |
| 95 | + |
| 96 | +### 3. View the overview |
| 97 | + |
| 98 | +After TaskRun completes, open the TaskRun's **Overview** tab to see the rendered Markdown. |
| 99 | + |
| 100 | +If nothing renders, check the step logs to confirm the file was written to `$(results.overview-markdown.path)` and that the result name is correct. |
| 101 | + |
| 102 | +### 4. (Optional) Use it in Pipelines |
| 103 | + |
| 104 | +In a Pipeline, each Task can output its **own** `overview-markdown`. The Overview tab will display separate sections per Task (e.g., `lint`, `scan`, `build`). |
| 105 | + |
| 106 | +You **do not** need to the **Pipeline**'s results for this feature. Only **Task** results are rendered in the Overview tab. |
| 107 | + |
| 108 | +Example Pipeline (replace `<lint-image>` `<scan-image>` as needed): |
| 109 | + |
| 110 | +```yaml |
| 111 | +apiVersion: tekton.dev/v1 |
| 112 | +kind: Pipeline |
| 113 | +metadata: |
| 114 | + name: pipeline-with-summaries |
| 115 | +spec: |
| 116 | + tasks: |
| 117 | + - name: lint |
| 118 | + taskSpec: |
| 119 | + results: |
| 120 | + - name: overview-markdown |
| 121 | + description: "Lint overview" |
| 122 | + type: string |
| 123 | + steps: |
| 124 | + - name: run-lint |
| 125 | + image: <lint-image> |
| 126 | + script: | |
| 127 | + #!/bin/bash |
| 128 | + cat >"$(results.overview-markdown.path)" <<'EOF' |
| 129 | + ## Lint Overview |
| 130 | +
|
| 131 | + - Files checked: **128** |
| 132 | + - Issues: **0** |
| 133 | + - Tool: `golangci-lint 1.57.2` |
| 134 | + EOF |
| 135 | + |
| 136 | + - name: scan |
| 137 | + runAfter: [lint] |
| 138 | + taskSpec: |
| 139 | + results: |
| 140 | + - name: overview-markdown |
| 141 | + description: "Security scan overview" |
| 142 | + type: string |
| 143 | + steps: |
| 144 | + - name: run-scan |
| 145 | + image: <scan-image> |
| 146 | + script: | |
| 147 | + #!/bin/bash |
| 148 | + cat >"$(results.overview-markdown.path)" <<'EOF' |
| 149 | + ## Security Scan |
| 150 | +
|
| 151 | + **Findings** |
| 152 | + - Critical: **0** |
| 153 | + - High: **1** (CVE-2025-XXXX) |
| 154 | + - Medium: **3** |
| 155 | + EOF |
| 156 | +``` |
| 157 | +
|
| 158 | +Example PipelineRun: |
| 159 | +
|
| 160 | +```yaml |
| 161 | +apiVersion: tekton.dev/v1 |
| 162 | +kind: PipelineRun |
| 163 | +metadata: |
| 164 | + name: pipeline-with-summaries-run |
| 165 | +spec: |
| 166 | + pipelineRef: |
| 167 | + name: pipeline-with-summaries |
| 168 | +``` |
| 169 | +
|
| 170 | +Open the PipelineRun's **Overview** tab. You should see two Markdown sections: **lint** and **scan**. |
| 171 | +
|
| 172 | +## Tips |
| 173 | +
|
| 174 | +- **Exact name matters:** The result must be named `overview-markdown` (case‑sensitive). |
| 175 | +- **Write to the right place:** Always write to `$(results.overview-markdown.path)`. You don't need a Pipeline‑level result. |
| 176 | +- **Size limit:** A single Task result value is capped at **4 KB** by default. If you want to configure the result size limit, you can refer to [Result Limit Exceeded When Writing Tekton Task Results](../trouble_shooting/result-limit-exceeded.mdx). |
| 177 | + |
| 178 | +## Troubleshooting |
| 179 | + |
| 180 | +- **Nothing shows in the Overview tab** |
| 181 | + - Check the result name: it must be exactly `overview-markdown`. |
| 182 | + - Verify the step wrote to `$(results.overview-markdown.path)`. |
| 183 | + - Confirm your UI version supports this feature. |
| 184 | +- **Pod logs show termination message overflow** |
| 185 | + - Refer to [Result Limit Exceeded When Writing Tekton Task Results](../trouble_shooting/result-limit-exceeded.mdx). |
0 commit comments