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

If the WhenExpression of the task is evaluated to false immediately after the pipelinerun is started, the pipelinerun stays in "Running(Started)" state #3203

Closed
VeereshAradhya opened this issue Sep 11, 2020 · 3 comments · Fixed by #3217
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@VeereshAradhya
Copy link

VeereshAradhya commented Sep 11, 2020

Expected Behavior

The Pipelinerun should start and run successfully

Actual Behavior

If the WhenExpression of the task is evaluated to false immediately after the pipelinerun is started, the pipelinerun stays in "Running(Started)" state for a pipeline which has sequential tasks (tasks which run after another)

Steps to Reproduce the Problem

  1. Create 2 tasks (task-1, task-2)
  2. Create a pipeline in such a way that task-2 runs after the task-1 and add WhenExpression to the task-2
  3. Make sure that the WhenExpression of the task-2 always fails and always gets executed immediately when the pipelinerun is started (you can use static input to make sure that the WhenExpression always fails)
  4. Start the pipeline and check the status of the pipelinerun

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+8b0a82f", GitCommit:"8b0a82f", GitTreeState:"clean", BuildDate:"2020-07-10T05:34:00Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
    
  • Tekton Pipeline version:

    $ tkn version
    Client version: 0.12.0
    Pipeline version: v0.16.0
    Triggers version: unknown
    

Command Execution Logs:

$ kubectl get pipeline pipeline-with-when-expression -o yaml
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  creationTimestamp: "2020-09-11T05:38:05Z"
  generation: 18
  managedFields:
  - apiVersion: tekton.dev/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        .: {}
        f:params: {}
        f:resources: {}
        f:tasks: {}
    manager: Mozilla
    operation: Update
    time: "2020-09-11T08:35:28Z"
  name: pipeline-with-when-expression
  namespace: veeresh-testing
  resourceVersion: "412847"
  selfLink: /apis/tekton.dev/v1beta1/namespaces/veeresh-testing/pipelines/pipeline-with-when-expression
  uid: 3bc57b32-e865-4d57-ac0d-d32ad235898b
spec:
  params:
  - name: status-1
    type: string
  tasks:
  - name: task-1
    taskRef:
      kind: Task
      name: first-task
  - name: task-2
    runAfter:
    - task-1
    taskRef:
      kind: Task
      name: second-task
    when:
    - Input: $(params.status-1)
      Operator: in
      Values:
      - Success
      - success
$ 
$ 
$ tkn p start pipeline-with-when-expression -p status-1=Failure
PipelineRun started: pipeline-with-when-expression-run-6bd55

In order to track the PipelineRun progress run:
tkn pipelinerun logs pipeline-with-when-expression-run-6bd55 -f -n veeresh-testing
$ 
$ kubectl get pipelinerun
NAME                                      SUCCEEDED   REASON    STARTTIME   COMPLETIONTIME
pipeline-with-when-expression-run-6bd55   Unknown     Started   100s        
$ 
$ tkn pr ls
NAME                                      STARTED        DURATION   STATUS
pipeline-with-when-expression-run-6bd55   1 minute ago   ---        Running(Started)
$ 
$ kubectl get pipelinerun pipeline-with-when-expression-run-6bd55 -o yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  creationTimestamp: "2020-09-11T08:44:37Z"
  generateName: pipeline-with-when-expression-run-
  generation: 1
  labels:
    tekton.dev/pipeline: pipeline-with-when-expression
  managedFields:
  - apiVersion: tekton.dev/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:tekton.dev/pipeline: {}
      f:status:
        .: {}
        f:conditions: {}
        f:pipelineSpec:
          .: {}
          f:params: {}
          f:tasks: {}
        f:startTime: {}
    manager: controller
    operation: Update
    time: "2020-09-11T08:44:37Z"
  - apiVersion: tekton.dev/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:generateName: {}
      f:spec:
        .: {}
        f:params: {}
        f:pipelineRef:
          .: {}
          f:name: {}
    manager: tkn
    operation: Update
    time: "2020-09-11T08:44:37Z"
  name: pipeline-with-when-expression-run-6bd55
  namespace: veeresh-testing
  resourceVersion: "414792"
  selfLink: /apis/tekton.dev/v1beta1/namespaces/veeresh-testing/pipelineruns/pipeline-with-when-expression-run-6bd55
  uid: 5baedc5c-78b9-49ec-b05e-64a09c9156f9
spec:
  params:
  - name: status-1
    value: Failure
  pipelineRef:
    name: pipeline-with-when-expression
  timeout: 1h0m0s
status:
  conditions:
  - lastTransitionTime: "2020-09-11T08:44:37Z"
    reason: Started
    status: Unknown
    type: Succeeded
  pipelineSpec:
    params:
    - name: status-1
      type: string
    tasks:
    - name: task-1
      taskRef:
        kind: Task
        name: first-task
    - name: task-2
      runAfter:
      - task-1
      taskRef:
        kind: Task
        name: second-task
      when:
      - Input: $(params.status-1)
        Operator: in
        Values:
        - Success
        - success
  startTime: "2020-09-11T08:44:37Z"
$ 
$ 
$ kubectl get pipelinerun
NAME                                      SUCCEEDED   REASON    STARTTIME   COMPLETIONTIME
pipeline-with-when-expression-run-6bd55   Unknown     Started   3m6s        
$ 
$ tkn pr ls
NAME                                      STARTED         DURATION   STATUS
pipeline-with-when-expression-run-6bd55   4 minutes ago   ---        Running(Started)
$ tkn tr ls
No TaskRuns found
$ kubectl get taskrun
No resources found.
@VeereshAradhya VeereshAradhya added the kind/bug Categorizes issue or PR as related to a bug. label Sep 11, 2020
@bobcatfish bobcatfish added this to the Pipelines 0.16.1 Bug-fix milestone Sep 11, 2020
@bobcatfish
Copy link
Collaborator

yikes! thanks for trying when expressions out so thoroughly @VeereshAradhya we'll get to this right away :D

@bobcatfish
Copy link
Collaborator

Quick update: aiming to have a release with a fix for this out on Monday

@bobcatfish
Copy link
Collaborator

Okay 0.16.2 is up now (https://github.com/tektoncd/pipeline/releases/tag/v0.16.2) please let us know if you still run into problems!

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

Successfully merging a pull request may close this issue.

2 participants