Skip to content

Commit

Permalink
[WIP] Add example new per-feature flag for POC
Browse files Browse the repository at this point in the history
This commit adds example new per-feature flag for POC.
It will be removed once the PR is tested and is ready to merge.
  • Loading branch information
JeromeJu committed Sep 5, 2023
1 parent 8137d23 commit 927220f
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 2 deletions.
8 changes: 8 additions & 0 deletions config/config-feature-flags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,11 @@ data:
# This allows TaskRuns to run in namespaces with "restricted" pod security standards.
# Not all Kubernetes implementations support this option.
set-security-context: "false"
# Per feature flags
#
# alpha: v0.52
#
# ExampleNewFeature serves as an POC for testing purposes.
# It will be removed once the PR is tested and is ready to merge.
# It is disabled by default.
enable-new-example-feature: "false"
1 change: 1 addition & 0 deletions pkg/apis/config/testdata/feature-flags-all-flags-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ data:
trusted-resources-verification-no-match-policy: "fail"
enable-provenance-in-status: "false"
set-security-context: "true"
enable-new-example-feature: "false"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: ConfigMap
metadata:
name: feature-flags
namespace: tekton-pipelines
data:
example-new-feature: "im-not-a-valid-feature-gate"
75 changes: 73 additions & 2 deletions pkg/reconciler/pipelinerun/pipelinerun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,11 @@ status:
EnableProvenanceInStatus: true
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`)
d := test.Data{
PipelineRuns: prs,
Expand Down Expand Up @@ -4829,6 +4833,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`)

expectedPr := expectedPrStatus
Expand Down Expand Up @@ -4988,6 +4996,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`)

expectedPr := expectedPrStatus
Expand Down Expand Up @@ -8354,6 +8366,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}, {
name: "p-finally",
Expand Down Expand Up @@ -8521,7 +8537,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}}
for _, tt := range tests {
Expand Down Expand Up @@ -8733,6 +8752,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}}
for _, tt := range tests {
Expand Down Expand Up @@ -9145,6 +9168,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}, {
name: "p-finally",
Expand Down Expand Up @@ -9350,6 +9377,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}}
for _, tt := range tests {
Expand Down Expand Up @@ -9586,6 +9617,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
},
}
Expand Down Expand Up @@ -10030,6 +10065,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}, {
name: "p-finally",
Expand Down Expand Up @@ -10208,6 +10247,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}}
for _, tt := range tests {
Expand Down Expand Up @@ -10434,6 +10477,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}, {
name: "indexing results in matrix.params",
Expand Down Expand Up @@ -10599,6 +10646,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}, {
name: "whole array result replacements in matrix.params",
Expand Down Expand Up @@ -10984,6 +11035,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}}
for _, tt := range tests {
Expand Down Expand Up @@ -11210,6 +11265,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
expectedTaskRuns: []*v1.TaskRun{
mustParseTaskRunWithObjectMeta(t,
Expand Down Expand Up @@ -11408,6 +11467,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
expectedTaskRuns: []*v1.TaskRun{
mustParseTaskRunWithObjectMeta(t,
Expand Down Expand Up @@ -11824,6 +11887,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}, {
name: "p-finally",
Expand Down Expand Up @@ -11992,6 +12059,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`),
}}
for _, tt := range tests {
Expand Down
12 changes: 12 additions & 0 deletions pkg/reconciler/taskrun/taskrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
provenance:
featureFlags:
RunningInEnvWithInjectedSidecars: true
Expand All @@ -1694,6 +1698,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`)
reconciliatonError = fmt.Errorf("1 error occurred:\n\t* Provided results don't match declared results; may be invalid JSON or missing result declaration: \"aResult\": task result is expected to be \"array\" type but was initialized to a different type \"string\"")
toBeRetriedTaskRun = parse.MustParseV1TaskRun(t, `
Expand Down Expand Up @@ -1747,6 +1755,10 @@ status:
ResultExtractionMethod: "termination-message"
MaxResultSize: 4096
Coschedule: "workspaces"
ExampleNewFeature:
Enabled: false
Stability: "alpha"
Name: "ExampleNewFeature"
`)
)

Expand Down
1 change: 1 addition & 0 deletions test/e2e-tests-kind-prow-alpha.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ RUN_YAML_TESTS=true
KO_DOCKER_REPO=registry.local:5000
E2E_GO_TEST_TIMEOUT=40m
RESULTS_FROM=sidecar-logs
ExampleNewFeature=true

0 comments on commit 927220f

Please sign in to comment.