You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TEP-0142: Add syntax for providing params to StepActions
Following the previous [PR](#7317), which introduced Params to the `StepAction` CRD,
this PR integrates `param` usage between `Steps` and `StepActions`. This PR adds the necessary syntax to `Steps` to pass `params` to `StepActions`. This work is part of
issue #7259.
Copy file name to clipboardExpand all lines: docs/stepactions.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,6 +206,8 @@ When a `Step` is referencing a `StepAction`, it can contain the following fields
206
206
- `securityContext`
207
207
- `envFrom`
208
208
- `timeout`
209
+
- `ref`
210
+
- `params`
209
211
210
212
Using any of the above fields and referencing a `StepAction` is allowed and will not cause an error. For example, the `TaskRun` below will execute without any errors:
211
213
@@ -220,10 +222,39 @@ spec:
220
222
- name: action-runner
221
223
ref:
222
224
name: step-action
225
+
params:
226
+
- name: step-action-param
227
+
value: hello
223
228
computeResources:
224
229
requests:
225
230
memory: 1Gi
226
231
cpu: 500m
227
232
timeout: 1h
228
233
onError: continue
229
234
```
235
+
236
+
### Passing Params to StepAction
237
+
238
+
A `StepAction` may require [params](#(declaring-parameters)). In this case, a `Task` needs to ensure that the `StepAction` has access to all the required `params`.
239
+
When referencing a `StepAction`, a `Step` can also provide it with `params`, just like how a `TaskRun` provides params to the underlying `Task`.
240
+
241
+
```yaml
242
+
apiVersion: tekton.dev/v1
243
+
kind: Task
244
+
metadata:
245
+
name: step-action
246
+
spec:
247
+
TaskSpec:
248
+
params:
249
+
- name: param-for-step-action
250
+
description: "this is a param that the step action needs."
251
+
steps:
252
+
- name: action-runner
253
+
ref:
254
+
name: step-action
255
+
params:
256
+
- name: step-action-param
257
+
value: $(params.param-for-step-action)
258
+
```
259
+
260
+
**Note:** If a `Step` declares `params` for an `inlined Step`, it will also lead to a validation error. This is because an `inlined Step` gets it's `params` from the `TaskRun`.
0 commit comments