Skip to content

Commit f040f9c

Browse files
author
edge-katanomi-app2[bot]
committed
📚 Sync docs from alaudadevops/tektoncd-operator on f9b0f8c854510b8e43e9a58be44b851e1210b52b
Source: docs: [DEVOPS-43325] add custom template docs (#1385) Author: yzc Ref: refs/heads/main Commit: f9b0f8c854510b8e43e9a58be44b851e1210b52b This commit automatically syncs documentation changes from the source-docs repository. 🔗 View source commit: https://github.com/alaudadevops/tektoncd-operator/commit/f9b0f8c854510b8e43e9a58be44b851e1210b52b 🤖 Synced on 2026-03-10 06:44:08 UTC
1 parent 00efbf2 commit f040f9c

19 files changed

Lines changed: 464 additions & 1965 deletions

‎.github/SYNC_INFO.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Documentation Sync Information
22

3-
- **Last synced**: 2026-03-06 05:53:41 UTC
3+
- **Last synced**: 2026-03-10 06:44:08 UTC
44
- **Source repository**: alaudadevops/tektoncd-operator
5-
- **Source commit**: [d605a75333ab1c48b3ef64e1d36ac362c0607274](https://github.com/alaudadevops/tektoncd-operator/commit/d605a75333ab1c48b3ef64e1d36ac362c0607274)
5+
- **Source commit**: [f9b0f8c854510b8e43e9a58be44b851e1210b52b](https://github.com/alaudadevops/tektoncd-operator/commit/f9b0f8c854510b8e43e9a58be44b851e1210b52b)
66
- **Triggered by**: edge-katanomi-app2[bot]
7-
- **Workflow run**: [#157](https://github.com/alaudadevops/tektoncd-operator/actions/runs/22751109506)
7+
- **Workflow run**: [#158](https://github.com/alaudadevops/tektoncd-operator/actions/runs/22890533934)
88

99
## Files synced:
1010
- docs/
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
weight: 14
3+
i18n:
4+
title:
5+
en: Configure tektoncd-enhancement ConfigMap via TektonConfig
6+
title: Configure tektoncd-enhancement ConfigMap via TektonConfig
7+
---
8+
9+
# Configure tektoncd-enhancement ConfigMap via TektonConfig
10+
11+
This guide shows how to manage `tektoncd-enhancement-config` through `TektonConfig` using `spec.pipeline.options.configMaps`.
12+
13+
> **Namespace Note**: Throughout this guide, `<tekton-pipelines>` is used as a placeholder for your `Tekton` namespace. Replace it with your actual namespace name. The default installation uses `tekton-pipelines` namespace.
14+
15+
## Prerequisites
16+
17+
- Tekton Operator is installed.
18+
- `TektonConfig` resource exists (usually named `config`).
19+
- You can edit `TektonConfig` in your cluster.
20+
21+
## Steps
22+
23+
### 1. Update TektonConfig with `spec.pipeline.options.configMaps`
24+
25+
The options structure follows the same pattern as described in [Adjusting Optional Configuration Items of Subcomponents](./customize_options).
26+
27+
Use a `TektonConfig` patch like this:
28+
29+
```yaml
30+
apiVersion: operator.tekton.dev/v1alpha1
31+
kind: TektonConfig
32+
metadata:
33+
name: config
34+
spec:
35+
targetNamespace: <tekton-pipelines>
36+
pipeline:
37+
options:
38+
configMaps:
39+
tektoncd-enhancement-config:
40+
data:
41+
config: |
42+
# Shared configuration for tektoncd-enhancement features.
43+
template-render:
44+
# Template to build the details URL.
45+
details-url-template: "{{- if .isPipelineRun -}}{{ .platformURL }}/console-acp/workspace/{{ .project }}~{{ .cluster }}~{{ .namespace }}/pipeline/pipelineRuns/detail/{{ .pipelineRunName }}{{- else -}}{{ .platformURL }}/console-acp/workspace/{{ .project }}~{{ .cluster }}~{{ .namespace }}/pipeline/taskRuns/detail/{{ .taskRunName }}{{- end -}}"
46+
# Empty value means using the container local time zone.
47+
time-zone: ""
48+
```
49+
50+
### 2. Parameter reference and defaults
51+
52+
| Parameter | Meaning | Default |
53+
|--------------------------------------------|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
54+
| `template-render.details-url-template` | Go template used to render `detailsURL` for mail/template rendering context. | `{{- if .isPipelineRun -}}{{ .platformURL }}/console-acp/workspace/{{ .project }}~{{ .cluster }}~{{ .namespace }}/pipeline/pipelineRuns/detail/{{ .pipelineRunName }}{{- else -}}{{ .platformURL }}/console-acp/workspace/{{ .project }}~{{ .cluster }}~{{ .namespace }}/pipeline/taskRuns/detail/{{ .taskRunName }}{{- end -}}` |
55+
| `template-render.time-zone` | Global time zone setting for template rendering. | `""` (use container local time zone) |
56+
57+
### 3. Verify ConfigMap update
58+
59+
After updating `TektonConfig`, check whether `tektoncd-enhancement-config` has been reconciled:
60+
61+
```bash
62+
kubectl get configmap tektoncd-enhancement-config -n <tekton-pipelines> -o yaml
63+
```
64+
65+
### 4. Restart tektoncd-enhancement
66+
67+
Restart the `tektoncd-enhancement` workload in namespace `<tekton-pipelines>`:
68+
69+
```bash
70+
kubectl rollout restart deployment/tektoncd-enhancement -n <tekton-pipelines>
71+
# deployment.apps/tektoncd-enhancement restarted
72+
73+
kubectl rollout status deployment/tektoncd-enhancement -n <tekton-pipelines>
74+
# Waiting for deployment "tektoncd-enhancement" rollout to finish: 1 old replica is pending termination...
75+
# deployment "tektoncd-enhancement" successfully rolled out
76+
```
77+
78+
## FAQ
79+
80+
### I updated `TektonConfig`, but the effective config did not change. What should I check?
81+
82+
Check in this order:
83+
84+
1. `TektonConfig` was updated successfully.
85+
2. `tektoncd-enhancement-config` in namespace `<tekton-pipelines>` has the expected `data.config`.
86+
3. `tektoncd-enhancement` has been restarted and rollout is complete.
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
weight: 13
3+
i18n:
4+
title:
5+
en: Configure Custom Mail Templates
6+
title: Configure Custom Mail Templates
7+
---
8+
9+
# Configure Custom Mail Templates
10+
11+
## Introduction
12+
13+
This guide explains how to add a new custom mail notification template for the `Send Mail` Task.
14+
15+
## Scenarios
16+
17+
For most use cases, use built-in templates first:
18+
19+
- **Default Mail Template**: outputs basic information of the current PipelineRun.
20+
- **Custom Mail Template**: supports custom email content through provided template options.
21+
22+
If built-in templates do not meet your requirements, follow this guide to create and configure a new template.
23+
24+
## Prerequisites
25+
26+
- `Send Mail` Task is available in your cluster.
27+
- You have permission to create `ConfigMap` in the target template namespace.
28+
29+
## Template Support in Send Mail
30+
31+
The `Send Mail` Task supports template-based rendering for `subject`, `body`, and `contentType`.
32+
By referencing a shared template `ConfigMap`, teams can maintain mail content globally and reuse the same template across multiple pipelines.
33+
34+
For rendering workflow, built-in variables, and `renderTemplateValues` details, see [Supported Template Parameters for Tasks](./supported-template-parameters).
35+
36+
## Steps
37+
38+
### 1. Create a template ConfigMap
39+
40+
Create a `ConfigMap` and set parameters as follows:
41+
42+
Required parameters:
43+
44+
- Label `tekton.alaudadevops.io/template-type: mail`:
45+
marks this `ConfigMap` as a mail template so the webhook can identify it as a render source for `Send Mail`.
46+
- Data keys `subject.tpl`, `body.tpl`, `contentType.tpl`:
47+
rendered with Go template (gotemplate) syntax and mapped to `subject`, `body`, and `contentType` params.
48+
For gotemplate syntax, see [Go `text/template` documentation](https://pkg.go.dev/text/template).
49+
For available template variables, see [Supported Template Parameters for Tasks](./supported-template-parameters).
50+
51+
Optional parameters:
52+
53+
- Annotation `tekton.alaudadevops.io/template-display-name`:
54+
human-readable name shown in UI selectors and preview panels.
55+
- Annotation `style.tekton.dev/descriptors`:
56+
defines a nested form for `renderTemplateValues` in UI, so users can fill template variables with form controls instead of manually editing YAML. For descriptor syntax and patterns, see [How to Configure Dynamic Forms](./configure_dynamic_forms.mdx).
57+
58+
Example:
59+
60+
```yaml
61+
apiVersion: v1
62+
kind: ConfigMap
63+
metadata:
64+
name: release-mail-template
65+
namespace: kube-public
66+
labels:
67+
tekton.alaudadevops.io/template-type: mail
68+
annotations:
69+
tekton.alaudadevops.io/template-display-name: "Release Mail Template"
70+
style.tekton.dev/descriptors: |
71+
- path: params.extraMessage
72+
x-descriptors:
73+
- urn:alm:descriptor:label:en:Extra Message
74+
- urn:alm:descriptor:description:en:Additional message shown in mail body.
75+
- urn:alm:descriptor:com.tectonic.ui:text
76+
- urn:alm:descriptor:placeholder:en:Input an extra message
77+
data:
78+
subject.tpl: "PipelineRun {{ .context.pipelineRun.name }} - {{ .tasks.status }}"
79+
body.tpl: |
80+
PipelineRun: {{ .context.pipelineRun.name }}
81+
Status: {{ .tasks.status }}
82+
Message: {{ .values.extraMessage }}
83+
contentType.tpl: "text/plain; charset=UTF-8"
84+
```
85+
86+
### 2. Configure pipeline to use your template
87+
88+
Set `renderTemplateName` and `renderTemplateNamespace`, then pass custom values through `renderTemplateValues`.
89+
90+
```yaml
91+
apiVersion: tekton.dev/v1
92+
kind: Pipeline
93+
metadata:
94+
name: demo-pipeline-with-mail-template
95+
spec:
96+
workspaces:
97+
- name: smtp-credentials
98+
tasks:
99+
- name: build
100+
taskRef:
101+
name: build-task
102+
finally:
103+
- name: notify
104+
taskRef:
105+
name: send-mail
106+
params:
107+
- name: sendMailImage
108+
value: registry.alauda.cn:60070/devops/tektoncd/hub/msmtp:latest
109+
- name: renderTemplateName
110+
value: release-mail-template
111+
- name: renderTemplateNamespace
112+
value: kube-public
113+
- name: renderTemplateValues
114+
value: |
115+
extraMessage: "Project: {{ .project }}, Namespace: {{ .namespace }}"
116+
- name: from
117+
value: no-reply@example.com
118+
- name: to
119+
value:
120+
- team@example.com
121+
workspaces:
122+
- name: smtp-credentials
123+
workspace: smtp-credentials
124+
```
125+
126+
### 3. Verify rendering results
127+
128+
Check a mutated `TaskRun` and confirm `subject`, `body`, and `contentType` have been appended to `spec.params`.
129+
130+
```yaml
131+
apiVersion: tekton.dev/v1
132+
kind: TaskRun
133+
metadata:
134+
name: demo-pipeline-with-mail-template-notify
135+
namespace: demo
136+
spec:
137+
taskRef:
138+
name: send-mail
139+
params:
140+
- name: renderTemplateName
141+
value: release-mail-template
142+
- name: renderTemplateNamespace
143+
value: kube-public
144+
- name: renderTemplateValues
145+
value: |
146+
extraMessage: "Project: demo, Namespace: demo"
147+
- name: subject
148+
value: "PipelineRun demo-pipeline-run - Succeeded"
149+
- name: body
150+
value: |
151+
PipelineRun: demo-pipeline-run
152+
Status: Succeeded
153+
Message: Project: demo, Namespace: demo
154+
- name: contentType
155+
value: "text/plain; charset=UTF-8"
156+
```
157+
158+
If rendering fails, check TaskRun annotation `tekton.alaudadevops.io/template-render-error`.
159+
160+
## FAQ
161+
162+
### Do I have to configure `style.tekton.dev/descriptors`?
163+
164+
No. It is optional. Configure it only when you want a structured UI form for `renderTemplateValues`.
165+
166+
### Can I use both built-in variables and `values.xxx` in the same template?
167+
168+
Yes. You can combine built-in variables (for example, `.context.pipelineRun.name`, `.tasks.status`) with user values such as `.values.extraMessage`.
169+
170+
### What happens if `renderTemplateName` is not set?
171+
172+
Template rendering is skipped. You need to provide `subject` and `body` params manually.
173+
174+
### What should I check first when rendering does not work?
175+
176+
1. Confirm `renderTemplateName` and `renderTemplateNamespace` point to an existing template `ConfigMap`.
177+
2. Confirm the `ConfigMap` includes label `tekton.alaudadevops.io/template-type: mail` and required keys `subject.tpl`, `body.tpl`, and `contentType.tpl`.
178+
3. Check TaskRun annotation `tekton.alaudadevops.io/template-render-error` for the concrete error message.

0 commit comments

Comments
 (0)