Skip to content

Commit f9d3923

Browse files
author
edge-katanomi-app2[bot]
committed
📚 Sync docs from alaudadevops/tektoncd-operator on e7201b8fad0d1f3f4ec20685b2952064c5485054
Source: docs(pipelines): improve manual approval gate guide (#795) Author: l-qing Ref: refs/heads/main Commit: e7201b8fad0d1f3f4ec20685b2952064c5485054 This commit automatically syncs documentation changes from the source-docs repository. 🔗 View source commit: https://github.com/alaudadevops/tektoncd-operator/commit/e7201b8fad0d1f3f4ec20685b2952064c5485054 🤖 Synced on 2025-11-19 06:24:11 UTC
1 parent f6cc7e7 commit f9d3923

File tree

2 files changed

+155
-6
lines changed

2 files changed

+155
-6
lines changed

‎.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**: 2025-11-18 05:24:12 UTC
3+
- **Last synced**: 2025-11-19 06:24:11 UTC
44
- **Source repository**: alaudadevops/tektoncd-operator
5-
- **Source commit**: [515298d9e11daf0aafc74cb495f7fc8d983584f7](https://github.com/alaudadevops/tektoncd-operator/commit/515298d9e11daf0aafc74cb495f7fc8d983584f7)
5+
- **Source commit**: [e7201b8fad0d1f3f4ec20685b2952064c5485054](https://github.com/alaudadevops/tektoncd-operator/commit/e7201b8fad0d1f3f4ec20685b2952064c5485054)
66
- **Triggered by**: edge-katanomi-app2[bot]
7-
- **Workflow run**: [#96](https://github.com/alaudadevops/tektoncd-operator/actions/runs/19455181392)
7+
- **Workflow run**: [#97](https://github.com/alaudadevops/tektoncd-operator/actions/runs/19491976814)
88

99
## Files synced:
1010
- docs/

‎docs/en/pipelines/how_to/manual_approval_gate.mdx‎

Lines changed: 152 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,38 +100,187 @@ Important status fields:
100100

101101
### 3. Approve or reject
102102

103+
#### User approvals
104+
105+
First, inspect the approvers list to determine the correct index:
106+
103107
```bash
104108
$ kubectl get approvaltask deploy-with-approval-run-wait-for-approval -o json | jq '.spec.approvers'
109+
[
110+
{
111+
"name": "alice",
112+
"type": "User",
113+
"input": "pending",
114+
},
115+
{
116+
"name": "release-managers",
117+
"type": "Group",
118+
"input": "pending",
119+
"users": []
120+
}
121+
]
122+
```
105123

124+
To approve as a user:
125+
126+
```bash
106127
$ kubectl patch approvaltask deploy-with-approval-run-wait-for-approval \
107128
--type='json' \
108129
--as alice \
109130
-p='[
110131
{"op":"replace","path":"/spec/approvers/0/input","value":"approve"},
111132
{"op":"replace","path":"/spec/approvers/0/message","value":"QA complete"}
112133
]'
134+
```
113135

136+
To reject as a user:
137+
138+
```bash
114139
$ kubectl patch approvaltask deploy-with-approval-run-wait-for-approval \
115140
--type='json' \
116141
--as alice \
117142
-p='[
118143
{"op":"replace","path":"/spec/approvers/0/input","value":"reject"},
119144
{"op":"replace","path":"/spec/approvers/0/message","value":"Found regression"}
120145
]'
146+
```
147+
148+
#### Group approvals
149+
150+
When a group is configured as an approver, individual members of that group can submit their approval by adding their response to the `users` array under the group entry. Multiple group members can approve independently, and each approval counts toward the `approvalsReceived` total.
121151

152+
Initially, the group approver entry does not have a `users` field:
153+
154+
```yaml
155+
spec:
156+
approvers:
157+
- name: alice
158+
type: User
159+
input: pending
160+
message: ""
161+
- name: release-managers
162+
type: Group
163+
input: pending
164+
message: ""
165+
numberOfApprovalsRequired: 2
166+
```
167+
168+
The first group member creates the `users` array and sets the group's `input` to approve:
169+
170+
```bash
171+
# First member (bob) from release-managers group approves
122172
$ kubectl patch approvaltask deploy-with-approval-run-wait-for-approval \
123173
--type='json' \
124174
--as bob \
125175
--as-group release-managers \
126176
-p='[
177+
{"op":"add","path":"/spec/approvers/1/users","value":[{"name":"bob","input":"approve"}]},
178+
{"op":"replace","path":"/spec/approvers/1/input","value":"approve"},
179+
{"op":"replace","path":"/spec/approvers/1/message","value":"Approved by bob"}
180+
]'
181+
```
182+
183+
Subsequent group members append to the existing `users` array and update the group's `input`:
184+
185+
```bash
186+
# Second member (carol) from release-managers group also approves
187+
$ kubectl patch approvaltask deploy-with-approval-run-wait-for-approval \
188+
--type='json' \
189+
--as carol \
190+
--as-group release-managers \
191+
-p='[
192+
{"op":"add","path":"/spec/approvers/1/users/-","value":{"name":"carol","input":"approve"}},
127193
{"op":"replace","path":"/spec/approvers/1/input","value":"approve"},
128-
{"op":"replace","path":"/spec/approvers/1/message","value":"Group approval from release-managers"}
194+
{"op":"replace","path":"/spec/approvers/1/message","value":"Approved by carol"}
195+
]'
196+
```
197+
198+
To reject as a group member:
199+
200+
```bash
201+
# A member (david) from release-managers group rejects
202+
$ kubectl patch approvaltask deploy-with-approval-run-wait-for-approval \
203+
--type='json' \
204+
--as david \
205+
--as-group release-managers \
206+
-p='[
207+
{"op":"add","path":"/spec/approvers/1/users/-","value":{"name":"david","input":"reject"}},
208+
{"op":"replace","path":"/spec/approvers/1/input","value":"reject"},
209+
{"op":"replace","path":"/spec/approvers/1/message","value":"Security concerns found"}
129210
]'
130211
```
131212

132-
The first command helps you determine the array index for your approver entry. The JSON patches then update only the matched entry's `input` and `message`, whether it represents a user (`alice` in the example) or a user impersonating a group (`bob` acting for `release-managers`). The controller sets the corresponding `CustomRun` and `PipelineRun` to `Succeeded` or `Failed` accordingly: approvals accumulate until `numberOfApprovalsRequired` is satisfied, while any rejection immediately fails that section of the pipeline.
213+
After these patches, check the group entry and status to see all members' responses:
214+
215+
```bash
216+
$ kubectl get approvaltask deploy-with-approval-run-wait-for-approval -o json | jq '{spec: .spec.approvers[1], status: .status}'
217+
{
218+
"spec": {
219+
"input": "approve",
220+
"message": "Approved by carol",
221+
"name": "release-managers",
222+
"type": "Group",
223+
"users": [
224+
{
225+
"input": "approve",
226+
"name": "bob"
227+
},
228+
{
229+
"input": "approve",
230+
"name": "carol"
231+
}
232+
]
233+
},
234+
"status": {
235+
"approvalsReceived": 2,
236+
"approvalsRequired": 2,
237+
"approvers": [
238+
"alice",
239+
"release-managers"
240+
],
241+
"approversResponse": [
242+
{
243+
"groupMembers": [
244+
{
245+
"message": "Approved by carol",
246+
"name": "bob",
247+
"response": "approved"
248+
},
249+
{
250+
"message": "Approved by carol",
251+
"name": "carol",
252+
"response": "approved"
253+
}
254+
],
255+
"message": "Approved by carol",
256+
"name": "release-managers",
257+
"response": "approved",
258+
"type": "Group"
259+
}
260+
],
261+
"startTime": "2025-11-18T14:07:48Z",
262+
"state": "approved"
263+
}
264+
}
265+
```
266+
267+
In this example, both `bob` and `carol` from the `release-managers` group have approved. Each approval from a group member increments `approvalsReceived` separately, so two group member approvals count as two approvals toward the required total. The `status.approversResponse` shows detailed approval information including individual group members' responses.
268+
269+
**Key points for group approvals:**
270+
271+
- Each group member must perform **two required operations**: add their entry to the `users` array AND set the group's `input` (either `approve` or `reject`). Optionally, they can also set the group's `message`
272+
- The first group member creates the `users` array using path `/spec/approvers/<index>/users` with an array value
273+
- Subsequent members append to the array using path `/spec/approvers/<index>/users/-` where `-` appends to the array end
274+
- Each user entry in the `users` array contains only `name` and `input` fields (no `message` field within the user entry)
275+
- The group-level `message` field is optional and shared; it will be overwritten by subsequent responses if they provide a new message
276+
- Each group member approval increments `approvalsReceived` independently
277+
- Multiple members from the same group can approve, and each counts toward the required total
278+
- The `status.approversResponse` field tracks detailed approval information including individual group members
279+
- Use `--as <username> --as-group <groupname>` to identify as a group member when patching
280+
281+
The controller sets the corresponding `CustomRun` and `PipelineRun` to `Succeeded` or `Failed` accordingly: approvals accumulate until `numberOfApprovalsRequired` is satisfied, while any rejection immediately fails that section of the pipeline.
133282

134-
> **Tip:** Use `--as <username>` (required) and optionally `--as-group <group>` when you need to approve as a specific identity. The validation webhook allows you to modify only the entry that matches that impersonated user, so you often impersonate a user while also attaching the relevant group. RBAC must grant you impersonation rights. For example, `kubectl patch ... --as release-robot --as-group release-managers` simulates a service account acting for the `release-managers` group.
283+
> **Tip:** Use `--as <username>` (required) and `--as-group <group>` when you need to approve as a specific identity. The validation webhook allows you to modify only the entry that matches that impersonated user and group. RBAC must grant you impersonation rights. For example, `kubectl patch ... --as bob --as-group release-managers` identifies you as user `bob` acting within the `release-managers` group.
135284

136285
### 4. Extend `PipelineRun` timeouts for long approvals
137286

0 commit comments

Comments
 (0)