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-0121: Retries - Reconciler Implementation #5844

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

XinruZhang
Copy link
Member

@XinruZhang XinruZhang commented Dec 7, 2022

Changes

This is the second peice of TEP-0121 implementation, targeting at merging it as part in release v0.43.0.

Prior to this PR, retries logic for TaskRun is handled by Tekton PipelineRun reconciler. This PR delegates the retries implementation for TaskRun to the TaskRun reconciler.

The major change is we stopped relying on len(retriesStatus) to decide if a target TaskRun failed or not. Instead, we use status ConditionSuceeded to gate the completion of a TaskRun. Even a TaskRun failed on one execution, as long as it has remaining retries, the TaskRun won't be stored in etcd with its status set as Failed. Instead, the status will be:

Type: Succeeded
Status: Unknown
Reason: ToBeRetried

It is worth noticing that, we still need to use len(retriesStatus) for Custom Tasks because currently we still support the alpha version, once we fully migrate custom task to the beta, we can safely remove that reliance.

Note that the integration test retry_test.go still works.

This is a demo video in an API WG meeting [18:05-21:00]

/close #5756

/kind feature

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • 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)
  • 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 tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesnt merit a release note. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 7, 2022
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 7, 2022
@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/taskrun_types.go 76.9% 77.4% 0.4
pkg/apis/pipeline/v1beta1/taskrun_conversion.go 92.2% 92.3% 0.1
pkg/apis/pipeline/v1beta1/taskrun_types.go 78.2% 78.6% 0.4
pkg/pod/status.go 90.9% 91.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.8% -0.4
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.7% 94.9% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 97.9% 97.7% -0.2
pkg/reconciler/taskrun/taskrun.go 82.1% 80.7% -1.4

@XinruZhang XinruZhang force-pushed the TEP-0121-Reconciler branch 2 times, most recently from 1da1ab8 to f5f814f Compare December 7, 2022 16:19
@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/taskrun_types.go 76.9% 77.4% 0.4
pkg/apis/pipeline/v1beta1/taskrun_conversion.go 92.2% 92.3% 0.1
pkg/apis/pipeline/v1beta1/taskrun_types.go 78.2% 78.6% 0.4
pkg/pod/status.go 90.9% 91.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.8% -0.4
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.7% 94.9% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 97.9% 97.7% -0.2
pkg/reconciler/taskrun/taskrun.go 82.1% 80.9% -1.2

@XinruZhang
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests
flake: TestGitPipelineRun

@XinruZhang
Copy link
Member Author

XinruZhang commented Dec 7, 2022

/assign @jerop

cc @tektoncd/core-maintainers

@jerop jerop added this to the Pipelines v0.43 milestone Dec 7, 2022
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2022
@XinruZhang
Copy link
Member Author

/unhold

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 8, 2022
@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/pod/status.go 90.9% 91.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.8% -0.4
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.7% 94.9% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 97.9% 97.7% -0.2
pkg/reconciler/taskrun/taskrun.go 82.1% 80.9% -1.2

@jerop jerop changed the title TEP-0121: Reconciler Implementation TEP-0121: Retries - Reconciler Implementation Dec 8, 2022
@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/pod/status.go 90.9% 91.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.8% -0.4
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.7% 94.9% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 97.9% 97.7% -0.2
pkg/reconciler/taskrun/taskrun.go 82.1% 80.9% -1.2

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 8, 2022
@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/pod/status.go 90.9% 91.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.8% -0.4
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.7% 94.9% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 97.9% 97.7% -0.2

@XinruZhang
Copy link
Member Author

/hold until #5853 is fixed

@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/pod/status.go 90.3% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.1% 85.7% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 82.6% 83.0% 0.4

@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/pod/status.go 90.3% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.1% 85.7% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 82.6% 83.0% 0.4

@XinruZhang
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests
Flake: TestExamples/v1beta1/taskruns/authenticating-git-commands

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you @XinruZhang for the great work on this and sorry about the late review 🙏
I have a few comments, but mostly minor or not blocking, or related to test coverage.

For events, I think it would be good align the events to the conditions, to be consistent to how things are today. It should be a minor change to implement, let me know what you think.

pkg/reconciler/pipelinerun/resources/pipelinerunstate.go Outdated Show resolved Hide resolved
pkg/reconciler/taskrun/taskrun.go Show resolved Hide resolved
pkg/reconciler/taskrun/taskrun_test.go 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/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@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/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@afrittoli
Copy link
Member

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

File Old Coverage New Coverage Delta
pkg/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@chitrangpatel It looks like finally the go coverage work you made has been deployed, and I see that the coverage report is reported twice. However it looks like the links are broken for one of the two implementations. Would you mind having a look?

@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/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 21, 2022
Prior to this commit, `retries` logic for TaskRun is handled by
Tekton `PipelineRun` reconciler. This commit delegates the retries
implementation for `TaskRun` to the `TaskRun` reconciler.

The major change is we stopped relying on `len(retriesStatus)` to
decide if a target `TaskRun` failed or not. Instead, we use status
`ConditionSuceeded` to gate the completion of a `TaskRun`. Even a
`TaskRun` failed on one execution, as long as it has remaining
retries, the TaskRun won't be stored in etcd with its status set
as `Failed`. Instead, the status will be:

```yaml
Type: Succeeded
Status: Unknown
Reason: ToBeRetried
```
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 21, 2022
@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/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/pod/status.go 90.4% 90.5% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.3% 94.9% 0.6
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.5% 96.4% -0.1
pkg/reconciler/taskrun/taskrun.go 83.1% 83.6% 0.4

@afrittoli
Copy link
Member

/lgtm

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TEP 0121 - Refine Retries
7 participants