Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEP-0050] Add OnError field #7162

Merged

Conversation

QuanZhang-William
Copy link
Member

@QuanZhang-William QuanZhang-William commented Sep 28, 2023

Changes

Part of #7165. In TEP-0050, we proposed to add an OnError API field under PipelineTask to configure error handling strategy.

This commits add the new OnError API field and the related documentations. The validation and business logic will be added in the follow-up PRs.

Note: OnError is in preview mode and not yet supported.

/kind feature

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

None

@tekton-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 28, 2023
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Sep 29, 2023
@QuanZhang-William QuanZhang-William marked this pull request as ready for review September 29, 2023 13:57
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 29, 2023
> :seedling: This feature is in **Preview Only** mode and not yet supported/implemented.

When a `PipelineTask` fails, the rest of the `PipelineTasks` are skipped and the `PipelineRun` is declared a failure. If you would like to
ignore such `PipelineTask` failure and continue executing the rest of the `PipelineTasks`, you can specify `onError` for such a `PipelineTask`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the case when the Task produces a result that may be needed downstream or by the pipeline?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't setting it to just "continue" without providing a value to the outputs of the task make it fail?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! I spoke too soon. You already go over that use case below.

```

- If the consuming `PipelineTask` has `OnError:stopAndFail`, the `PipelineRun` will fail with `InvalidTaskResultReference`.
- If the consuming `PipelineTask` has `OnError:continue`, the consuming `PipelineTask` will be skipped with reason `Results were missing`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming. This would ensure that all the subsequent Tasks that in-turn depend on this skipped Task would also be skipped right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, and to be more specific:

all subsequent resource-dependent tasks (with onError:continue) would be skipped if the result is not emitted.

@chitrangpatel
Copy link
Contributor

Thanks for the PR @QuanZhang-William. I think the v1beta1 types will also require relevant conversion functions. I suppose you are going to add that in a follow-up PR?
I would recommend adding the type completely in a single PR (i.e. conversion, defaults and empty validations ). And then in the followup PR, you can add actual validation followed by controller logic. WDYT?

@Yongxuanzhang
Copy link
Member

why don't we add the docs when the feature is implemented?

@QuanZhang-William
Copy link
Member Author

Thanks for the PR @QuanZhang-William. I think the v1beta1 types will also require relevant conversion functions. I suppose you are going to add that in a follow-up PR? I would recommend adding the type completely in a single PR (i.e. conversion, defaults and empty validations ). And then in the followup PR, you can add actual validation followed by controller logic. WDYT?

Hi @chitrangpatel, sure I can put them in a single PR. I don't think we need to apply default values for this field though (which is same for step.OnError).

@QuanZhang-William
Copy link
Member Author

why don't we add the docs when the feature is implemented?

Hi @Yongxuanzhang. Seems like this the pattern we follow recently:

I feel users could be confused if we add an API field but has no documentation on it. I have called out in the doc that the feature is WIP and do not use it.

Copy link
Member

@Yongxuanzhang Yongxuanzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

pkg/apis/pipeline/v1/pipeline_types.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 29, 2023
@Yongxuanzhang
Copy link
Member

Could you also link the issue to track all the work plan? Thanks!

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 29, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@QuanZhang-William QuanZhang-William changed the title [TEP-0050] Add OnError field and documentation [TEP-0050] Add OnError field Sep 29, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@QuanZhang-William
Copy link
Member Author

Could you also link the issue to track all the work plan? Thanks!

Sure, tracking issue added: #7165

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Yongxuanzhang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 11, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

docs/pipelines.md Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@dibyom
Copy link
Member

dibyom commented Oct 16, 2023

@QuanZhang-William I think we should remove the release note - release notes are aimed towards users and since the feature doesn't work yet, I think it is confusing to add it

otherwise, LGTM

@dibyom
Copy link
Member

dibyom commented Oct 16, 2023

/lgtm

@tekton-robot tekton-robot added lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 16, 2023
@QuanZhang-William
Copy link
Member Author

/retest

In [TEP-0050][tep-0050], we proposed to add an `OnError` API field under `PipelineTask` to configure error handling strategy.

This commits add the new `OnError` API field and the related validation, conversion and validation. The business logic will be added in the follow-up PRs.

Note: OnError is in preview mode and not yet supported.

/kind feature

[tep-0050]: https://github.com/tektoncd/community/blob/main/teps/0050-ignore-task-failures.md
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 17, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_validation.go 99.1% 99.2% 0.0
pkg/apis/pipeline/v1beta1/pipeline_conversion.go 95.3% 95.3% 0.0
pkg/apis/pipeline/v1beta1/pipeline_validation.go 98.8% 98.8% 0.0

@JeromeJu
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 17, 2023
@QuanZhang-William
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests
due to timeout

@tekton-robot tekton-robot merged commit c9ff759 into tektoncd:main Oct 17, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants