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
Copy file name to clipboardexpand all lines: docs/taskruns.md
+10
Original file line number
Diff line number
Diff line change
@@ -402,6 +402,16 @@ case is when your CI system autogenerates `TaskRuns` and it has `Parameters` it
402
402
provide to all `TaskRuns`. Because you can pass in extra `Parameters`, you don't have to
403
403
go through the complexity of checking each `Task` and providing only the required params.
404
404
405
+
#### Parameter Enums
406
+
407
+
> :seedling: **Specifying `enum` is an [alpha](additional-configs.md#alpha-features) feature.** The `enable-param-enum` feature flag must be set to `"true"` to enable this feature.
408
+
409
+
> :seedling: This feature is WIP and not yet supported/implemented. Documentation to be completed.
410
+
411
+
If a `Parameter` is guarded by `Enum` in the `Task`, you can only provide `Parameter` values in the `TaskRun` that are predefined in the `Param.Enum` in the `Task`. The `TaskRun` will fail with reason `InvalidParamValue` otherwise.
412
+
413
+
See more details in [Param.Enum](./tasks.md#param-enum).
414
+
405
415
### Specifying `Resource` limits
406
416
407
417
Each Step in a Task can specify its resource requirements. See
Copy file name to clipboardexpand all lines: docs/tasks.md
+20-1
Original file line number
Diff line number
Diff line change
@@ -717,7 +717,26 @@ spec:
717
717
718
718
> :seedling: This feature is WIP and not yet supported/implemented. Documentation to be completed.
719
719
720
-
Parameter declarations can include `enum` which is a predefine set of valid values that can be accepted by the `Task`.
720
+
Parameter declarations can include `enum` which is a predefine set of valid values that can be accepted by the `Param`. For example, the valid/allowed values for `Param` "message" is bounded to `v1`, `v2` and `v3`:
721
+
722
+
``` yaml
723
+
apiVersion: tekton.dev/v1
724
+
kind: Task
725
+
metadata:
726
+
name: param-enum-demo
727
+
spec:
728
+
params:
729
+
- name: message
730
+
type: string
731
+
enum: ["v1", "v2", "v3"]
732
+
steps:
733
+
- name: build
734
+
image: bash:latest
735
+
script: |
736
+
echo "$(params.message)"
737
+
```
738
+
739
+
If the `Param` value passed in by `TaskRuns` is **NOT** in the predefined `enum` list, the `TaskRuns` will fail with reason `InvalidParamValue`.
0 commit comments