diff --git a/config/config-feature-flags.yaml b/config/config-feature-flags.yaml index 3b24d383ffb..01ac93e7703 100644 --- a/config/config-feature-flags.yaml +++ b/config/config-feature-flags.yaml @@ -72,9 +72,7 @@ data: enable-tekton-oci-bundles: "false" # Setting this flag to "true" enables the use of custom tasks from # within pipelines. - # This is an experimental feature and thus should still be considered - # an alpha feature. - enable-custom-tasks: "false" + enable-custom-tasks: "true" # Setting this flag will determine which gated features are enabled. # Acceptable values are "stable", "beta", or "alpha". enable-api-fields: "stable" diff --git a/docs/install.md b/docs/install.md index ce1e1434d7a..f34cf7ba9ee 100644 --- a/docs/install.md +++ b/docs/install.md @@ -408,7 +408,7 @@ not running. and use Workspaces to mount credentials from Secrets instead. The default is `false`. For more information, see the [associated issue](https://github.com/tektoncd/pipeline/issues/3399). -- `enable-custom-tasks`: set this flag to `"true"` to enable the +- `enable-custom-tasks`: set this flag to `"false"` to disable the use of custom tasks in pipelines. - `enable-api-fields`: set this flag to "stable" to allow only the diff --git a/docs/pipelines.md b/docs/pipelines.md index 0ad7782e082..f4ca7ea2c4f 100644 --- a/docs/pipelines.md +++ b/docs/pipelines.md @@ -1564,9 +1564,6 @@ no `runAfter` can be specified in `finally` tasks. ## Using Custom Tasks -**Note: This is only allowed if `enable-custom-tasks` is set to -`"true"` in the `feature-flags` configmap, see [`install.md`](./install.md#customizing-the-pipelines-controller-behavior)** - [Custom Tasks](https://github.com/tektoncd/community/blob/main/teps/0002-custom-tasks.md) can implement behavior that doesn't correspond directly to running a workload in a `Pod` on the cluster. For example, a custom task might execute some operation outside of the cluster and wait for its execution to complete. diff --git a/pkg/apis/config/feature_flags.go b/pkg/apis/config/feature_flags.go index cee53395be5..71dee99f42a 100644 --- a/pkg/apis/config/feature_flags.go +++ b/pkg/apis/config/feature_flags.go @@ -73,7 +73,7 @@ const ( // DefaultEnableTektonOciBundles is the default value for "enable-tekton-oci-bundles". DefaultEnableTektonOciBundles = false // DefaultEnableCustomTasks is the default value for "enable-custom-tasks". - DefaultEnableCustomTasks = false + DefaultEnableCustomTasks = true // DefaultEnableAPIFields is the default value for "enable-api-fields". DefaultEnableAPIFields = StableAPIFields // DefaultSendCloudEventsForRuns is the default value for "send-cloudevents-for-runs". diff --git a/pkg/apis/config/feature_flags_test.go b/pkg/apis/config/feature_flags_test.go index ba4b813f1fb..4d38cb266a6 100644 --- a/pkg/apis/config/feature_flags_test.go +++ b/pkg/apis/config/feature_flags_test.go @@ -140,6 +140,7 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) { expectedConfig: &config.FeatureFlags{ EnableAPIFields: "stable", EmbeddedStatus: "full", + EnableCustomTasks: config.DefaultEnableCustomTasks, EnableSpire: true, ResourceVerificationMode: config.DefaultResourceVerificationMode, RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars, @@ -158,6 +159,7 @@ func TestNewFeatureFlagsFromConfigMap(t *testing.T) { RunningInEnvWithInjectedSidecars: config.DefaultRunningInEnvWithInjectedSidecars, AwaitSidecarReadiness: config.DefaultAwaitSidecarReadiness, ResultExtractionMethod: config.ResultExtractionMethodSidecarLogs, + EnableCustomTasks: config.DefaultEnableCustomTasks, MaxResultSize: 8192, CustomTaskVersion: config.DefaultCustomTaskVersion, }, diff --git a/pkg/apis/pipeline/v1/pipeline_types_test.go b/pkg/apis/pipeline/v1/pipeline_types_test.go index 3e9d00ef33e..e76416a9913 100644 --- a/pkg/apis/pipeline/v1/pipeline_types_test.go +++ b/pkg/apis/pipeline/v1/pipeline_types_test.go @@ -320,7 +320,6 @@ func TestPipelineTask_Validate_Failure(t *testing.T) { Message: `invalid value: custom task ref must specify kind`, Paths: []string{"taskRef.kind"}, }, - wc: enableFeatures(t, []string{"enable-custom-tasks"}), }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/pkg/apis/pipeline/v1/pipeline_validation_test.go b/pkg/apis/pipeline/v1/pipeline_validation_test.go index 4adce87e3c2..fa2fc7ec65f 100644 --- a/pkg/apis/pipeline/v1/pipeline_validation_test.go +++ b/pkg/apis/pipeline/v1/pipeline_validation_test.go @@ -25,12 +25,10 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/test/diff" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/selection" "knative.dev/pkg/apis" - logtesting "knative.dev/pkg/logging/testing" ) func TestPipeline_Validate_Success(t *testing.T) { @@ -54,7 +52,6 @@ func TestPipeline_Validate_Success(t *testing.T) { Tasks: []PipelineTask{{Name: "foo", TaskRef: &TaskRef{APIVersion: "example.dev/v0", Kind: "Example", Name: ""}}}, }, }, - wc: enableFeatures(t, []string{"enable-custom-tasks"}), }, { name: "pipelinetask custom task spec", p: &Pipeline{ @@ -72,7 +69,6 @@ func TestPipeline_Validate_Success(t *testing.T) { }}, }, }, - wc: enableFeatures(t, []string{"enable-custom-tasks"}), }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -664,10 +660,10 @@ func TestValidatePipelineTasks_Failure(t *testing.T) { }, }}, finalTasks: nil, - expectedError: apis.FieldError{ + expectedError: *apis.ErrGeneric("").Also(&apis.FieldError{ Message: "taskSpec.apiVersion cannot be specified when using taskSpec.steps", Paths: []string{"tasks[0].taskSpec.apiVersion"}, - }, + }).Also(apis.ErrInvalidValue("custom task spec must specify kind", "tasks[0].taskSpec.kind")), }, { name: "kind with steps", tasks: []PipelineTask{{ @@ -3197,18 +3193,3 @@ func getTaskSpec() TaskSpec { }}, } } - -func enableFeatures(t *testing.T, features []string) func(context.Context) context.Context { - return func(ctx context.Context) context.Context { - s := config.NewStore(logtesting.TestLogger(t)) - data := make(map[string]string) - for _, f := range features { - data[f] = "true" - } - s.OnConfigChanged(&corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{Name: config.GetFeatureFlagsConfigName()}, - Data: data, - }) - return s.ToContext(ctx) - } -} diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types_test.go b/pkg/apis/pipeline/v1beta1/pipeline_types_test.go index f15b76c8cbd..2bb09a37d2f 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_types_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types_test.go @@ -359,7 +359,6 @@ func TestPipelineTask_Validate_Failure(t *testing.T) { Message: `invalid value: custom task ref must specify kind`, Paths: []string{"taskRef.kind"}, }, - wc: enableFeatures(t, []string{"enable-custom-tasks"}), }, { name: "invalid bundle without bundle name", p: PipelineTask{ @@ -707,7 +706,7 @@ func TestPipelineTaskList_Validate(t *testing.T) { TaskRef: &TaskRef{Name: "task"}, }}, path: "tasks", - wc: enableFeatures(t, []string{"enable-custom-tasks", "enable-tekton-oci-bundles"}), + wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }, { name: "validate list of tasks with valid custom task and bundle but invalid regular task", tasks: PipelineTaskList{{ @@ -722,7 +721,7 @@ func TestPipelineTaskList_Validate(t *testing.T) { }}, path: "tasks", expectedError: apis.ErrGeneric(`invalid value: taskRef must specify name`, "tasks[2].taskRef.name"), - wc: enableFeatures(t, []string{"enable-custom-tasks", "enable-tekton-oci-bundles"}), + wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }, { name: "validate list of tasks with valid custom task but invalid bundle and invalid regular task", tasks: PipelineTaskList{{ @@ -738,7 +737,7 @@ func TestPipelineTaskList_Validate(t *testing.T) { path: "tasks", expectedError: apis.ErrGeneric(`invalid value: taskRef must specify name`, "tasks[2].taskRef.name").Also( apis.ErrGeneric(`missing field(s)`, "tasks[1].taskRef.name")), - wc: enableFeatures(t, []string{"enable-custom-tasks", "enable-tekton-oci-bundles"}), + wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }, { name: "validate all three invalid tasks - custom task, bundle and regular task", tasks: PipelineTaskList{{ @@ -755,7 +754,7 @@ func TestPipelineTaskList_Validate(t *testing.T) { expectedError: apis.ErrGeneric(`invalid value: taskRef must specify name`, "tasks[2].taskRef.name").Also( apis.ErrGeneric(`missing field(s)`, "tasks[1].taskRef.name")).Also( apis.ErrGeneric(`invalid value: custom task ref must specify kind`, "tasks[0].taskRef.kind")), - wc: enableFeatures(t, []string{"enable-custom-tasks", "enable-tekton-oci-bundles"}), + wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go index f51194d9716..e19bde33f41 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go @@ -55,7 +55,6 @@ func TestPipeline_Validate_Success(t *testing.T) { Tasks: []PipelineTask{{Name: "foo", TaskRef: &TaskRef{APIVersion: "example.dev/v0", Kind: "Example", Name: ""}}}, }, }, - wc: enableFeatures(t, []string{"enable-custom-tasks"}), }, { name: "pipelinetask custom task spec", p: &Pipeline{ @@ -73,7 +72,6 @@ func TestPipeline_Validate_Success(t *testing.T) { }}, }, }, - wc: enableFeatures(t, []string{"enable-custom-tasks"}), }, { name: "valid pipeline with params, resources, workspaces, task results, and pipeline results", p: &Pipeline{ @@ -777,10 +775,10 @@ func TestValidatePipelineTasks_Failure(t *testing.T) { }, }}, finalTasks: nil, - expectedError: apis.FieldError{ + expectedError: *apis.ErrGeneric("").Also(&apis.FieldError{ Message: "taskSpec.apiVersion cannot be specified when using taskSpec.steps", Paths: []string{"tasks[0].taskSpec.apiVersion"}, - }, + }).Also(apis.ErrInvalidValue("custom task spec must specify kind", "tasks[0].taskSpec.kind")), }, { name: "kind with steps", tasks: []PipelineTask{{ diff --git a/pkg/reconciler/pipelinerun/cancel_test.go b/pkg/reconciler/pipelinerun/cancel_test.go index 75bcf9378b8..c82ea06645e 100644 --- a/pkg/reconciler/pipelinerun/cancel_test.go +++ b/pkg/reconciler/pipelinerun/cancel_test.go @@ -376,7 +376,7 @@ func TestCancelPipelineRun(t *testing.T) { } ctx, _ := ttesting.SetupFakeContext(t) cfg := config.NewStore(logtesting.TestLogger(t)) - cfg.OnConfigChanged(withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatus))) + cfg.OnConfigChanged(withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatus)) ctx = cfg.ToContext(ctx) ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -637,7 +637,7 @@ func TestGetChildObjectsFromPRStatusForTaskNames(t *testing.T) { t.Run(tc.name, func(t *testing.T) { ctx, _ := ttesting.SetupFakeContext(t) cfg := config.NewStore(logtesting.TestLogger(t)) - cm := withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatus)) + cm := withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatus) if tc.useV1Beta1CustomTask { cm = withCustomTaskVersion(cm, config.CustomTaskVersionBeta) } diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index b75ce151764..dbba88ff5f5 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -110,7 +110,6 @@ var ( const ( apiFieldsFeatureFlag = "enable-api-fields" - customTasksFeatureFlag = "enable-custom-tasks" ociBundlesFeatureFlag = "enable-tekton-oci-bundles" embeddedStatusFeatureFlag = "embedded-status" maxMatrixCombinationsCountFlag = "default-max-matrix-combinations-count" @@ -703,7 +702,7 @@ spec: if embeddedStatus == "" { embeddedStatus = config.DefaultEmbeddedStatus } - cms := []*corev1.ConfigMap{withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus))} + cms := []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)} d := test.Data{ PipelineRuns: []*v1beta1.PipelineRun{tc.pr}, @@ -898,7 +897,7 @@ spec: if embeddedStatus == "" { embeddedStatus = config.DefaultEmbeddedStatus } - cms := []*corev1.ConfigMap{withCustomTaskVersion(withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)), "v1beta1")} + cms := []*corev1.ConfigMap{withCustomTaskVersion(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus), "v1beta1")} d := test.Data{ PipelineRuns: []*v1beta1.PipelineRun{tc.pr}, @@ -1642,12 +1641,6 @@ func withEnabledAlphaAPIFields(cm *corev1.ConfigMap) *corev1.ConfigMap { return newCM } -func withCustomTasks(cm *corev1.ConfigMap) *corev1.ConfigMap { - newCM := cm.DeepCopy() - newCM.Data[customTasksFeatureFlag] = "true" - return newCM -} - func withOCIBundles(cm *corev1.ConfigMap) *corev1.ConfigMap { newCM := cm.DeepCopy() newCM.Data[ociBundlesFeatureFlag] = "true" @@ -1802,7 +1795,7 @@ status: type: Succeeded startTime: "2021-12-31T23:58:59Z" `)} - cms := []*corev1.ConfigMap{withCustomTasks(newFeatureFlagsConfigMap())} + cms := []*corev1.ConfigMap{newFeatureFlagsConfigMap()} d := test.Data{ PipelineRuns: prs, Pipelines: ps, @@ -1916,7 +1909,7 @@ status: creationTime: "2021-12-31T11:58:58Z" `)} - cms := []*corev1.ConfigMap{withCustomTasks(newFeatureFlagsConfigMap())} + cms := []*corev1.ConfigMap{newFeatureFlagsConfigMap()} d := test.Data{ PipelineRuns: prs, Pipelines: ps, @@ -3511,7 +3504,7 @@ spec: pipelineTaskName: hello-world-1 `)} - cms := []*corev1.ConfigMap{withCustomTasks(newFeatureFlagsConfigMap())} + cms := []*corev1.ConfigMap{newFeatureFlagsConfigMap()} d := test.Data{ PipelineRuns: prs, Pipelines: ps, @@ -3730,7 +3723,7 @@ spec: taskServiceAccountName: custom-sa `)} - cms := []*corev1.ConfigMap{withCustomTasks(newFeatureFlagsConfigMap())} + cms := []*corev1.ConfigMap{newFeatureFlagsConfigMap()} d := test.Data{ PipelineRuns: prs, Pipelines: ps, @@ -5025,7 +5018,7 @@ spec: Tasks: ts, TaskRuns: trs, Runs: rs, - ConfigMaps: []*corev1.ConfigMap{withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus))}, + ConfigMaps: []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)}, } prt := newPipelineRunTest(d, t) defer prt.Cancel() @@ -5381,7 +5374,7 @@ spec: Tasks: ts, TaskRuns: trs, Runs: rs, - ConfigMaps: []*corev1.ConfigMap{withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus))}, + ConfigMaps: []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)}, } prt := newPipelineRunTest(d, t) @@ -6008,7 +6001,7 @@ status: trs := []*v1beta1.TaskRun{taskRunDone, taskRunOrphaned} runs := []*v1alpha1.Run{orphanedRun} - cms := []*corev1.ConfigMap{withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus))} + cms := []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)} d := test.Data{ PipelineRuns: prs, @@ -6208,7 +6201,7 @@ spec: name: some-custom-task `) - cms := []*corev1.ConfigMap{withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus))} + cms := []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)} d := test.Data{ PipelineRuns: []*v1beta1.PipelineRun{pr}, @@ -10989,7 +10982,7 @@ spec: ts := []*v1beta1.Task{simpleHelloWorldTask} - cms := []*corev1.ConfigMap{withEmbeddedStatus(withCustomTasks(newFeatureFlagsConfigMap()), tc.embeddedStatusVal)} + cms := []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatusVal)} d := test.Data{ PipelineRuns: prs, diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go index f129487e3e1..90f0863946c 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go @@ -2061,12 +2061,6 @@ func TestResolvePipelineRun_CustomTask(t *testing.T) { pipelineState := PipelineRunState{} ctx := context.Background() cfg := config.NewStore(logtesting.TestLogger(t)) - cfg.OnConfigChanged(&corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{Name: config.GetFeatureFlagsConfigName()}, - Data: map[string]string{ - "enable-custom-tasks": "true", - }, - }) ctx = cfg.ToContext(ctx) for _, task := range pts { ps, err := ResolvePipelineTask(ctx, pr, nopGetTask, nopGetTaskRun, getRun, task, nil) @@ -2883,12 +2877,6 @@ func TestIsCustomTask(t *testing.T) { t.Run(tc.name, func(t *testing.T) { ctx := context.Background() cfg := config.NewStore(logtesting.TestLogger(t)) - cfg.OnConfigChanged(&corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{Name: config.GetFeatureFlagsConfigName()}, - Data: map[string]string{ - "enable-custom-tasks": "true", - }, - }) ctx = cfg.ToContext(ctx) rpt, err := ResolvePipelineTask(ctx, pr, getTask, getTaskRun, getRun, tc.pt, nil) if err != nil { diff --git a/pkg/reconciler/pipelinerun/timeout_test.go b/pkg/reconciler/pipelinerun/timeout_test.go index c42e56ef64d..696dff9a172 100644 --- a/pkg/reconciler/pipelinerun/timeout_test.go +++ b/pkg/reconciler/pipelinerun/timeout_test.go @@ -278,7 +278,7 @@ func TestTimeoutPipelineRun(t *testing.T) { } ctx, _ := ttesting.SetupFakeContext(t) cfg := config.NewStore(logtesting.TestLogger(t)) - cm := withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatus)) + cm := withEmbeddedStatus(newFeatureFlagsConfigMap(), tc.embeddedStatus) if tc.useV1Beta1CustomTasks { cm = withCustomTaskVersion(cm, config.CustomTaskVersionBeta) } diff --git a/test/custom_task_test.go b/test/custom_task_test.go index ef617ef357a..75848d90244 100644 --- a/test/custom_task_test.go +++ b/test/custom_task_test.go @@ -57,10 +57,6 @@ const ( ) var ( - supportedFeatureGates = map[string]string{ - "enable-custom-tasks": "true", - "enable-api-fields": "alpha", - } // We need this to be set because the way cancellation/timeout works, the full embedded status may not be updated // in the PipelineRun's status for the cancelled CustomRun/Run before the PipelineRun itself finishes reconciling, // so testing against "full" embedded status is inherently flaky. We currently only run these tests in @@ -71,7 +67,6 @@ var ( requiredEmbeddedStatusGate = map[string]string{ "embedded-status": "minimal", } - filterTypeMeta = cmpopts.IgnoreFields(metav1.TypeMeta{}, "Kind", "APIVersion") filterObjectMeta = cmpopts.IgnoreFields(metav1.ObjectMeta{}, "ResourceVersion", "UID", "CreationTimestamp", "Generation", "ManagedFields") filterCondition = cmpopts.IgnoreFields(apis.Condition{}, "LastTransitionTime.Inner.Time", "Message") @@ -84,7 +79,7 @@ func TestCustomTask(t *testing.T) { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - c, namespace := setup(ctx, t, requireAnyGate(supportedFeatureGates)) + c, namespace := setUpCustomTask(ctx, t, requireAllGates(requiredEmbeddedStatusGate)) knativetest.CleanupOnInterrupt(func() { tearDown(ctx, t, c, namespace) }, t.Logf) defer tearDown(ctx, t, c, namespace) @@ -288,8 +283,7 @@ func TestPipelineRunCustomTaskTimeout(t *testing.T) { // cancel the context after we have waited a suitable buffer beyond the given deadline. ctx, cancel := context.WithTimeout(context.Background(), timeout+2*time.Minute) defer cancel() - c, namespace := setUpCustomTask(ctx, t, combineGates(requireAnyGate(supportedFeatureGates), requireAllGates(requiredEmbeddedStatusGate))) - + c, namespace := setUpCustomTask(ctx, t, requireAllGates(requiredEmbeddedStatusGate)) knativetest.CleanupOnInterrupt(func() { tearDown(context.Background(), t, c, namespace) }, t.Logf) defer tearDown(context.Background(), t, c, namespace) @@ -437,7 +431,7 @@ func TestWaitCustomTask_Run(t *testing.T) { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - c, namespace := setUpCustomTask(ctx, t, requireAnyGate(supportedFeatureGates)) + c, namespace := setUpCustomTask(ctx, t, requireAllGates(requiredEmbeddedStatusGate)) knativetest.CleanupOnInterrupt(func() { tearDown(ctx, t, c, namespace) }, t.Logf) defer tearDown(ctx, t, c, namespace) @@ -601,7 +595,7 @@ func TestWaitCustomTask_PipelineRun(t *testing.T) { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - c, namespace := setUpCustomTask(ctx, t, combineGates(requireAnyGate(supportedFeatureGates), requireAllGates(requiredEmbeddedStatusGate))) + c, namespace := setUpCustomTask(ctx, t, requireAllGates(requiredEmbeddedStatusGate)) knativetest.CleanupOnInterrupt(func() { tearDown(ctx, t, c, namespace) }, t.Logf) defer tearDown(ctx, t, c, namespace) @@ -889,7 +883,7 @@ func TestWaitCustomTask_V1Beta1_PipelineRun(t *testing.T) { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - c, namespace := setUpV1Beta1CustomTask(ctx, t, combineGates(requireAnyGate(supportedFeatureGates), requireAllGates(requiredEmbeddedStatusGate))) + c, namespace := setUpV1Beta1CustomTask(ctx, t, requireAllGates(requiredEmbeddedStatusGate)) knativetest.CleanupOnInterrupt(func() { tearDownV1Beta1CustomTask(ctx, t, c, namespace) }, t.Logf) defer tearDownV1Beta1CustomTask(ctx, t, c, namespace) diff --git a/test/featureflags.go b/test/featureflags.go index 9c4b6c5af22..59fb1d767f9 100644 --- a/test/featureflags.go +++ b/test/featureflags.go @@ -14,16 +14,6 @@ import ( "knative.dev/pkg/system" ) -// combineGates returns a setup func wrapping multiple requireAnyGate or requireAllGates calls, and will skip -// the current test if any of the gate-check funcs fail. -func combineGates(gateFuncs ...func(context.Context, *testing.T, *clients, string)) func(context.Context, *testing.T, *clients, string) { - return func(ctx context.Context, t *testing.T, c *clients, namespace string) { - for _, gf := range gateFuncs { - gf(ctx, t, c, namespace) - } - } -} - // requireAnyGate returns a setup func that will skip the current // test if none of the feature-flags in the given map match // what's in the feature-flags ConfigMap. It will fatally fail