Skip to content

Commit e4b43a9

Browse files
[TEP-0144] Add feature flag and doc placeholder
Part of [tektoncd#7270][tektoncd#7270]. In [TEP-0144][tep-0144] we proposed a new `enum` field to support built-in param input validation. This commit adds the feature flag `enable-param-enum` and documentation placeholder for the feature. /kind feature [tektoncd#7270]: tektoncd#7270 [tep-0144]: https://github.com/tektoncd/community/blob/main/teps/0144-param-enum.md
1 parent 08ee164 commit e4b43a9

7 files changed

+61
-0
lines changed

config/config-feature-flags.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ data:
124124
# Setting this flag to "true" will enable the CEL evaluation in WhenExpression
125125
# This feature is in preview mode and not implemented yet. Please check #7244 for the updates.
126126
enable-cel-in-whenexpression: "false"
127+
<<<<<<< HEAD
127128
# Setting this flag to "true" will enable the use of StepActions in Steps
128129
# This feature is in preview mode and not implemented yet. Please check #7259 for updates.
129130
enable-step-actions: "false"
131+
=======
132+
# Setting this flag to "true" will enable the built-in param input validation via param enum.
133+
# NOTE (#7270): this feature is still under development and not yet functional.
134+
enable-param-enum: "false"
135+
>>>>>>> 13d26851f ([TEP-0144] Add feature flag and doc placeholder)

docs/pipelines.md

+7
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ spec:
269269
- "bar"
270270
```
271271

272+
#### Param enum
273+
> :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.
274+
275+
> :seedling: This feature is WIP and not yet supported/implemented. Documentation to be completed.
276+
277+
Parameter declarations can include `enum` which is a predefine set of valid values that can be accepted by the `Pipeline`.
278+
272279
## Adding `Tasks` to the `Pipeline`
273280

274281
Your `Pipeline` definition must reference at least one [`Task`](tasks.md).

docs/tasks.md

+7
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,13 @@ spec:
712712
- "--someotherflag"
713713
```
714714
715+
#### Param enum
716+
> :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.
717+
718+
> :seedling: This feature is WIP and not yet supported/implemented. Documentation to be completed.
719+
720+
Parameter declarations can include `enum` which is a predefine set of valid values that can be accepted by the `Task`.
721+
715722
### Specifying `Workspaces`
716723

717724
[`Workspaces`](workspaces.md#using-workspaces-in-tasks) allow you to specify

pkg/apis/config/feature_flags.go

+12
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ const (
100100
EnableStepActions = "enable-step-actions"
101101
// DefaultEnableStepActions is the default value for EnableStepActions
102102
DefaultEnableStepActions = false
103+
// EnableParamEnum is the flag to enabled enum in params
104+
EnableParamEnum = "enable-param-enum"
105+
// DefaultEnableParamEnum is the default value for EnableParamEnum
106+
DefaultEnableParamEnum = false
103107

104108
disableAffinityAssistantKey = "disable-affinity-assistant"
105109
disableCredsInitKey = "disable-creds-init"
@@ -149,7 +153,11 @@ type FeatureFlags struct {
149153
SetSecurityContext bool
150154
Coschedule string
151155
EnableCELInWhenExpression bool
156+
<<<<<<< HEAD
152157
EnableStepActions bool
158+
=======
159+
EnableParamEnum bool
160+
>>>>>>> 13d26851f ([TEP-0144] Add feature flag and doc placeholder)
153161
}
154162

155163
// GetFeatureFlagsConfigName returns the name of the configmap containing all
@@ -225,7 +233,11 @@ func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error) {
225233
if err := setFeature(EnableCELInWhenExpression, DefaultEnableCELInWhenExpression, &tc.EnableCELInWhenExpression); err != nil {
226234
return nil, err
227235
}
236+
<<<<<<< HEAD
228237
if err := setFeature(EnableStepActions, DefaultEnableStepActions, &tc.EnableStepActions); err != nil {
238+
=======
239+
if err := setFeature(EnableParamEnum, DefaultEnableParamEnum, &tc.EnableParamEnum); err != nil {
240+
>>>>>>> 13d26851f ([TEP-0144] Add feature flag and doc placeholder)
229241
return nil, err
230242
}
231243
// Given that they are alpha features, Tekton Bundles and Custom Tasks should be switched on if

pkg/apis/config/feature_flags_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) {
7474
SetSecurityContext: true,
7575
Coschedule: config.CoscheduleDisabled,
7676
EnableCELInWhenExpression: true,
77+
<<<<<<< HEAD
7778
EnableStepActions: true,
79+
=======
80+
EnableParamEnum: true,
81+
>>>>>>> 13d26851f ([TEP-0144] Add feature flag and doc placeholder)
7882
},
7983
fileName: "feature-flags-all-flags-set",
8084
},
@@ -277,6 +281,9 @@ func TestNewFeatureFlagsConfigMapErrors(t *testing.T) {
277281
}, {
278282
fileName: "feature-flags-invalid-enable-step-actions",
279283
want: `failed parsing feature flags config "invalid": strconv.ParseBool: parsing "invalid": invalid syntax`,
284+
}, {
285+
fileName: "feature-flags-invalid-enable-param-enum",
286+
want: `failed parsing feature flags config "invalid": strconv.ParseBool: parsing "invalid": invalid syntax`,
280287
}} {
281288
t.Run(tc.fileName, func(t *testing.T) {
282289
cm := test.ConfigMapFromTestFile(t, tc.fileName)

pkg/apis/config/testdata/feature-flags-all-flags-set.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ data:
3434
keep-pod-on-cancel: "true"
3535
enable-cel-in-whenexpression: "true"
3636
enable-step-actions: "true"
37+
enable-param-enum: "true"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 The Tekton Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ConfigMap
17+
metadata:
18+
name: feature-flags
19+
namespace: tekton-pipelines
20+
data:
21+
enable-param-enum: "invalid"

0 commit comments

Comments
 (0)