From 41192338e661b9dc7bceb845255221db89b5e082 Mon Sep 17 00:00:00 2001 From: pritidesai Date: Tue, 21 Sep 2021 11:23:19 -0700 Subject: [PATCH] Promoting onError to beta Pipeline 0.27 was released in August 2021 which introduced an alpha feature to specify onError in a step. This feature was implemented in the PR #4106: https://github.com/tektoncd/pipeline/pull/4106 To enable this feature, the Tekton Pipeline deployment had to set enable-api-fields to alpha. After discussing this in the API WG: https://docs.google.com/document/d/17PodAxG8hV351fBhSu7Y_OIPhGTVgj6OJ2lPphYYRpU/edit#heading=h.ig94pf1w10xc We have sent an email out to collect the feedback from the users. @skaegi is looking forward to this promotion. This commit is updating task validation to no longer require enable-api-fields is set to alpha. The documentation is updated to moved it out of the alpha section. The example yamls moved out of alpha. Updated e2e to not include alpha flag. --- docs/install.md | 1 - docs/tasks.md | 7 ++----- .../{alpha => }/ignore-step-error.yaml | 0 .../{alpha => }/ignore-step-error.yaml | 0 pkg/apis/pipeline/v1beta1/task_validation.go | 1 - .../pipeline/v1beta1/task_validation_test.go | 20 +------------------ test/ignore_step_error_test.go | 2 +- 7 files changed, 4 insertions(+), 27 deletions(-) rename examples/v1beta1/pipelineruns/{alpha => }/ignore-step-error.yaml (100%) rename examples/v1beta1/taskruns/{alpha => }/ignore-step-error.yaml (100%) diff --git a/docs/install.md b/docs/install.md index 5075891c865..61cebbe05f6 100644 --- a/docs/install.md +++ b/docs/install.md @@ -399,7 +399,6 @@ Features currently in "alpha" are: | [Hermetic Execution Mode](./hermetic.md) | [TEP-0025](https://github.com/tektoncd/community/blob/main/teps/0025-hermekton.md) | [v0.25.0](https://github.com/tektoncd/pipeline/releases/tag/v0.25.0) | | | [Graceful Termination](./pipelineruns.md#gracefully-cancelling-a-pipelinerun) | [TEP-0058](https://github.com/tektoncd/community/blob/main/teps/0058-graceful-pipeline-run-termination.md) | [v0.25.0](https://github.com/tektoncd/pipeline/releases/tag/v0.25.0) | | | [`PipelineRun` Timeouts](./pipelineruns.md#configuring-a-failure-timeout) | [TEP-0046](https://github.com/tektoncd/community/blob/main/teps/0046-finallytask-execution-post-timeout.md) | [v0.25.0](https://github.com/tektoncd/pipeline/releases/tag/v0.25.0) | | -| [Specifying `onError` for a `Step`](./tasks.md#specifying-onerror-for-a-step) | [TEP-0040](https://github.com/tektoncd/community/blob/main/teps/0040-ignore-step-errors.md) | [v0.27.0](https://github.com/tektoncd/pipeline/releases/tag/v0.27.0) | | | [Implicit `Parameters`](./taskruns.md#implicit-parameters) | [TEP-0023](https://github.com/tektoncd/community/blob/main/teps/0023-implicit-mapping.md) | [v0.28.0](https://github.com/tektoncd/pipeline/releases/tag/v0.28.0) | | | [Windows Scrips](./tasks.md#windows-scripts) | [TEP-0057](https://github.com/tektoncd/community/blob/main/teps/0057-windows-support.md) | [v0.28.0](https://github.com/tektoncd/pipeline/releases/tag/v0.28.0) | | diff --git a/docs/tasks.md b/docs/tasks.md index a614efa03bc..3ea610a0b69 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -335,9 +335,6 @@ steps: #### Specifying `onError` for a `step` -This is an alpha feature. The `enable-api-fields` feature flag [must be set to `"alpha"`](./install.md) -to specify `onError` for a `step`. - When a `step` in a `task` results in a failure, the rest of the steps in the `task` are skipped and the `taskRun` is declared a failure. If you would like to ignore such step errors and continue executing the rest of the steps in the task, you can specify `onError` for such a `step`. @@ -386,8 +383,8 @@ kubectl get tr taskrun-unit-test-t6qcl -o json | jq .status ], ``` -For an end-to-end example, see [the taskRun ignoring a step error](../examples/v1beta1/taskruns/alpha/ignore-step-error.yaml) -and [the pipelineRun ignoring a step error](../examples/v1beta1/pipelineruns/alpha/ignore-step-error.yaml). +For an end-to-end example, see [the taskRun ignoring a step error](../examples/v1beta1/taskruns/ignore-step-error.yaml) +and [the pipelineRun ignoring a step error](../examples/v1beta1/pipelineruns/ignore-step-error.yaml). #### Accessing Step's `exitCode` in subsequent `Steps` diff --git a/examples/v1beta1/pipelineruns/alpha/ignore-step-error.yaml b/examples/v1beta1/pipelineruns/ignore-step-error.yaml similarity index 100% rename from examples/v1beta1/pipelineruns/alpha/ignore-step-error.yaml rename to examples/v1beta1/pipelineruns/ignore-step-error.yaml diff --git a/examples/v1beta1/taskruns/alpha/ignore-step-error.yaml b/examples/v1beta1/taskruns/ignore-step-error.yaml similarity index 100% rename from examples/v1beta1/taskruns/alpha/ignore-step-error.yaml rename to examples/v1beta1/taskruns/ignore-step-error.yaml diff --git a/pkg/apis/pipeline/v1beta1/task_validation.go b/pkg/apis/pipeline/v1beta1/task_validation.go index 0f9223f6355..c7fc3684e1e 100644 --- a/pkg/apis/pipeline/v1beta1/task_validation.go +++ b/pkg/apis/pipeline/v1beta1/task_validation.go @@ -222,7 +222,6 @@ func validateStep(ctx context.Context, s Step, names sets.String) (errs *apis.Fi } if s.OnError != "" { - errs = errs.Also(ValidateEnabledAPIFields(ctx, "step onError", config.AlphaAPIFields).ViaField("steps")) if s.OnError != "continue" && s.OnError != "stopAndFail" { errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("invalid value: %v", s.OnError), diff --git a/pkg/apis/pipeline/v1beta1/task_validation_test.go b/pkg/apis/pipeline/v1beta1/task_validation_test.go index fc56a9286a8..c860b927ded 100644 --- a/pkg/apis/pipeline/v1beta1/task_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/task_validation_test.go @@ -1178,13 +1178,7 @@ func TestStepOnError(t *testing.T) { ts := &v1beta1.TaskSpec{ Steps: tt.steps, } - featureFlags, _ := config.NewFeatureFlagsFromMap(map[string]string{ - "enable-api-fields": "alpha", - }) - cfg := &config.Config{ - FeatureFlags: featureFlags, - } - ctx := config.ToContext(context.Background(), cfg) + ctx := context.Background() ts.SetDefaults(ctx) err := ts.Validate(ctx) if tt.expectedError == nil && err != nil { @@ -1241,18 +1235,6 @@ func TestIncompatibleAPIVersions(t *testing.T) { }}, }}, }, - }, { - name: "step onError requires alpha", - requiredVersion: "alpha", - spec: v1beta1.TaskSpec{ - Steps: []v1beta1.Step{{ - OnError: "continue", - Container: corev1.Container{ - Image: "image", - Args: []string{"arg"}, - }, - }}, - }, }, { name: "windows script support requires alpha", requiredVersion: "alpha", diff --git a/test/ignore_step_error_test.go b/test/ignore_step_error_test.go index 710ebb58a92..fbd66528816 100644 --- a/test/ignore_step_error_test.go +++ b/test/ignore_step_error_test.go @@ -33,7 +33,7 @@ func TestMissingResultWhenStepErrorIsIgnored(t *testing.T) { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - c, namespace := setup(ctx, t, requireAlphaFeatureFlags) + c, namespace := setup(ctx, t) knativetest.CleanupOnInterrupt(func() { tearDown(ctx, t, c, namespace) }, t.Logf) defer tearDown(ctx, t, c, namespace)