-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Graceful Pipeline Run Termination #3915
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
Conversation
|
Hi @rafalbigaj. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
|
/kind feature |
|
The following is the coverage report on the affected files.
|
| return errs | ||
| } | ||
|
|
||
| func validateSpecStatus(status PipelineRunSpecStatus) *apis.FieldError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to update the test function
| func TestPipelineRun_Invalid(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also guard validating the new fields with the feature gate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Done.
| pipelineRun: &v1beta1.PipelineRun{ | ||
| ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"}, | ||
| Spec: v1beta1.PipelineRunSpec{ | ||
| Status: v1beta1.PipelineRunSpecStatusCancelledDeprecated, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have a test with the non deprecated stopping and cancelling fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was added to cover deprecated status name (PipelineRunCancelled). The already existing ones cover the new status name (Cancelled).
|
/retest |
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
|
/retest |
|
The following is the coverage report on the affected files.
|
|
/test pull-tekton-pipeline-build-tests |
1 similar comment
|
/test pull-tekton-pipeline-build-tests |
| return nil | ||
| } | ||
| } | ||
| if alphaAPIFieldsEnabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to come back to this again. Here when the alphaFields is not enabled, we might have an error without any information given to the user. Would be nice to have a specific error in that case stating that it fails because the alphaFields are not enabled.
There is a helper function you may use:
| func ValidateEnabledAPIFields(ctx context.Context, featureName, wantVersion string) *apis.FieldError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing! Fixed
|
We are almost there, thanks a bunch once again for all the effort @rafalbigaj The changes look great and the pipeline state transitioning is much more meaningful now: I would like to hear your thoughts on |
The implementation of TEP-0058: Graceful Pipeline Run Termination. The new `spec.Status` values: - `StoppedRunFinally` - To "stop" (i.e. let the tasks complete, then execute finally tasks) a Pipeline - `CancelledRunFinally` - To "cancel" (i.e. interrupt any executing non finally tasks, then execute finally tasks) - `Cancelled` - Same as today's `PipelineRunCancelled` - i.e. interrupt any executing tasks without running finally tasks The new `PipelineRun` condition reasons: - `CancelledRunningFinally` - indicates that pipeline has been gracefully cancelled, but final tasks are now running - `StoppedRunningFinally` - indicates that pipeline has been gracefully stopped, but final tasks are now running Status `PipelineRunCancelled` is deprecated (replaced by `Cancelled`). The same applies to the condition reason. New features hidden by alpha API fields flag.
|
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for yet another update and for your patience!
I went through all the various tests and coverage again, and everything looks good to me.
I would be nice to have another quick docs PR on top to document that a pending pipeline cannot be cancelled via graceful cancel 🙏
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afrittoli 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 |
|
thank you once again @rafalbigaj for all the work and your patience, the changes look great. Very exciting for this 🎉 /lgtm |
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. When we updated the dependencies, we didn't change the constant we are using from tektoncd/pipeline and thus, we were using the new value that is only supported when alpha api are enabled — hence the CI is broken. This make the cli use the deprecated field for now, but we need to follow up to support graceful cancellation. Signed-off-by: Vincent Demeester <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. When we updated the dependencies, we didn't change the constant we are using from tektoncd/pipeline and thus, we were using the new value that is only supported when alpha api are enabled — hence the CI is broken. This make the cli use the deprecated field for now, but we need to follow up to support graceful cancellation. Signed-off-by: Vincent Demeester <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. When we updated the dependencies, we didn't change the constant we are using from tektoncd/pipeline and thus, we were using the new value that is only supported when alpha api are enabled — hence the CI is broken. This make the cli use the deprecated field for now, but we need to follow up to support graceful cancellation. Signed-off-by: Vincent Demeester <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. When we updated the dependencies, we didn't change the constant we are using from tektoncd/pipeline and thus, we were using the new value that is only supported when alpha api are enabled — hence the CI is broken. This make the cli use the deprecated field for now, but we need to follow up to support graceful cancellation. Signed-off-by: Vincent Demeester <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. In this patch, a new flag is introduced `--grace` which handles all the scenarios as follows --grace int Gracefully cancel a PipelineRun To use this, you need to change the feature-flags configmap enable-api-fields to alpha instead of stable. Ignored if set to a negative value. Set to 1 if you want to cancel the current running task and directly run the finally tasks. Set to 2 if you want to cancel the remaining non-final task and directly run the finally tasks. Signed-off-by: vinamra28 <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. In this patch, a new flag is introduced `--grace` which handles all the scenarios as follows --grace int Gracefully cancel a PipelineRun To use this, you need to change the feature-flags configmap enable-api-fields to alpha instead of stable. Ignored if set to a negative value. Set to 1 if you want to cancel the current running task and directly run the finally tasks. Set to 2 if you want to cancel the remaining non-final task and directly run the finally tasks. Signed-off-by: vinamra28 <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. In this patch, a new flag is introduced `--grace` which handles all the scenarios as follows --grace int Gracefully cancel a PipelineRun To use this, you need to change the feature-flags configmap enable-api-fields to alpha instead of stable. Ignored if set to a negative value. Set to 1 if you want to cancel the current running task and directly run the finally tasks. Set to 2 if you want to cancel the remaining non-final task and directly run the finally tasks. Signed-off-by: vinamra28 <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. In this patch, a new flag is introduced `--grace` which handles all the scenarios as follows --grace int Gracefully cancel a PipelineRun To use this, you need to change the feature-flags configmap enable-api-fields to alpha instead of stable. Ignored if set to a negative value. Set to 1 if you want to cancel the current running task and directly run the finally tasks. Set to 2 if you want to cancel the remaining non-final task and directly run the finally tasks. Signed-off-by: vinamra28 <[email protected]>
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. In this patch, a new flag is introduced `--grace` which handles all the scenarios as follows --grace int Gracefully cancel a PipelineRun To use this, you need to change the feature-flags configmap enable-api-fields to alpha instead of stable. Ignored if set to a negative value. Set to 1 if you want to cancel the current running task and directly run the finally tasks. Set to 2 if you want to cancel the remaining non-final task and directly run the finally tasks. Signed-off-by: vinamra28 <[email protected]>
Fixes tektoncd#4611. We deprecated the original cancelled status (with the value `PipelineRunCancelled`) in tektoncd#3915, and we're now at the time for it to be removed in favor of the value `Cancelled`. Signed-off-by: Andrew Bayer <[email protected]>
Fixes tektoncd#4611. We deprecated the original cancelled status (with the value `PipelineRunCancelled`) in tektoncd#3915, and we're now at the time for it to be removed in favor of the value `Cancelled`. Signed-off-by: Andrew Bayer <[email protected]>
Fixes #4611. We deprecated the original cancelled status (with the value `PipelineRunCancelled`) in #3915, and we're now at the time for it to be removed in favor of the value `Cancelled`. Signed-off-by: Andrew Bayer <[email protected]>
The implementation of TEP-0058: Graceful Pipeline Run Termination.
The new
spec.Statusvalues:StoppedRunFinally- To "stop" (i.e. let the tasks complete, then execute finally tasks) a PipelineCancelledRunFinally- To "cancel" (i.e. interrupt any executing non finally tasks, then execute finally tasks)Cancelled- Same as today'sPipelineRunCancelled- i.e. interrupt any executing tasks without running finally tasksPipelineRunCancelledis deprecated (replaced byCancelled)Changes
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes