Skip to content

Commit

Permalink
Promoting onError to beta
Browse files Browse the repository at this point in the history
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 tektoncd#4106:
tektoncd#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.
  • Loading branch information
pritidesai authored and chenbh committed Oct 27, 2021
1 parent 816b647 commit f2c57df
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 27 deletions.
1 change: 0 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | |

Expand Down
7 changes: 2 additions & 5 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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`
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/pipeline/v1beta1/task_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
20 changes: 1 addition & 19 deletions pkg/apis/pipeline/v1beta1/task_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/ignore_step_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f2c57df

Please sign in to comment.