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

Pipelinerun status will not be set to PipelineRunStopping if pipeline contains finally tasks #3119

Closed
VeereshAradhya opened this issue Aug 20, 2020 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@VeereshAradhya
Copy link

Expected Behavior

The pipelinerun status should be set to PipelineRunStopping when any of taskrun fails and other taskruns are still running (though pipeline contains finally tasks)

Actual Behavior

The pipelinerun status is not set to PipelineRunStopping when any of taskrun fails and other taskrus are still running when pipeline contains finally tasks

Steps to Reproduce the Problem

  1. Create a pipeline with 2 tasks and 1 finally task
  2. Make sure that one of the tasks fails before the other one
  3. Start the pipeline and observe the state of pipelinerun when one of the taskrun fails

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    Client Version: version.Info{Major:"1", Minor:"10+", GitVersion:"v1.10.0+b3b92b2", GitCommit:"b3b92b2", GitTreeState:"clean", BuildDate:"2020-07-15T09:27:21Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.3+002a51f", GitCommit:"002a51f", GitTreeState:"clean", BuildDate:"2020-08-10T05:10:21Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
    
  • Tekton Pipeline version:

Client version: 0.11.0
Pipeline version: v0.14.3
Triggers version: v0.6.1

Command execution logs:

[varadhya@localhost testing]$ tkn tr ls
No TaskRuns found
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ tkn pr ls
No PipelineRuns found
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ tkn p start pipeline-test-timeout 
? Value for param `first-param` of type `string`? check
PipelineRun started: pipeline-test-timeout-run-jndt9

In order to track the PipelineRun progress run:
tkn pipelinerun logs pipeline-test-timeout-run-jndt9 -f -n veeresh-testing
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ tkn pr ls
NAME                              STARTED         DURATION   STATUS
pipeline-test-timeout-run-jndt9   9 seconds ago   ---        Running
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ tkn tr ls
NAME                                                 STARTED          DURATION   STATUS
pipeline-test-timeout-run-jndt9-run-script-1-glh5t   18 seconds ago   ---        Running
pipeline-test-timeout-run-jndt9-run-script-2-jb2jw   18 seconds ago   ---        Running
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ tkn tr ls
NAME                                                 STARTED          DURATION   STATUS
pipeline-test-timeout-run-jndt9-run-script-1-glh5t   34 seconds ago   ---        Running
pipeline-test-timeout-run-jndt9-run-script-2-jb2jw   34 seconds ago   ---        Running
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$
[varadhya@localhost testing]$ tkn tr ls
NAME                                                 STARTED        DURATION   STATUS
pipeline-test-timeout-run-jndt9-run-script-1-glh5t   1 minute ago   ---        Running
pipeline-test-timeout-run-jndt9-run-script-2-jb2jw   1 minute ago   1 minute   Failed
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ tkn pr ls
NAME                              STARTED        DURATION   STATUS
pipeline-test-timeout-run-jndt9   1 minute ago   ---        Running
[varadhya@localhost testing]$ 
[varadhya@localhost testing]$ kubectl get pr 
NAME                              SUCCEEDED   REASON    STARTTIME   COMPLETIONTIME
pipeline-test-timeout-run-jndt9   Unknown     Running   92s         
[varadhya@localhost testing]$ kubectl get pr 
NAME                              SUCCEEDED   REASON    STARTTIME   COMPLETIONTIME
pipeline-test-timeout-run-jndt9   Unknown     Running   4m37s       

@VeereshAradhya VeereshAradhya added the kind/bug Categorizes issue or PR as related to a bug. label Aug 20, 2020
@vdemeester
Copy link
Member

/cc @pritidesai

@pritidesai
Copy link
Member

yes this is by design. stopping mode with finally does not make sense because once a task fails, finally tasks are scheduled right after that first failure. For pipeline without finally, once a task fails, pipeline waits for other running tasks to complete and does not schedule any new task i.e. pipeline goes in stopping state.

@pritidesai
Copy link
Member

Please refer to this section for details on pipelinerun status:

https://github.com/tektoncd/pipeline/blob/master/docs/pipelines.md#pipelinerun-status-with-finally

I am closing this.

@VeereshAradhya
Copy link
Author

The above link does not mention about the state PipelineRunStopping of pipelinerun, it only talks about the final state of the pipelinerun. I think it needs to be updated.

When I was going through the newly added features of v0.14.0, I found A new reason "PipelineRunStopping" indicate that the pipeline run has found a failure and is waiting for task runs to complete. and thought of testing that and I found that it does not work with finally so I filed this issue.

What is the expected state transition of the pipelinerun when there are multiple finally tasks running and one of it fails (since finally tasks are running, there will not be any new tasks to be scheduled), Is it Started -> Running -> Failed or Started -> Running -> PipelineRunStopping -> Failed?

@pritidesai
Copy link
Member

pritidesai commented Aug 21, 2020

Hi @VeereshAradhya PR #2774 introduced PipelineRunStopping for DAG tasks which was part of 0.14.0.

What is the expected state transition of the pipelinerun when there are multiple finally tasks running and one of it fails (since finally tasks are running, there will not be any new tasks to be scheduled), Is it Started -> Running -> Failed or Started -> Running -> PipelineRunStopping -> Failed?

The expected state transition in this case is Started -> Running -> Failed like its documented here. Pipeline will still be in Running state even after seeing one or more finally task failure.

Finally task failure does not transition into stopping state since expectation is rest of the final tasks have to be executed and pipeline keeps running until it finishes executing all finally tasks or it hits timeout. Also, a pipeline can have multiple or all finally tasks failure unlike DAG tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants