Uploaded image for project: 'OpenShift Pipelines'
  1. OpenShift Pipelines
  2. SRVKP-1724

Finally task not executed when tasks define "retries"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • Pipelines 1.8.0
    • Pipelines 1.5.2
    • None
    • 2
    • False
    • False
    • Hide
      * Before this update, if a pipeline had two parallel tasks that failed and one of them had `retries=2`, the final tasks never ran, and the Pipeline failed from a timeout. For example, the `pipelines-operator-subscription` task failed intermittently with an "Unable to connect to the server: EOF" error. With this update, the issue has been fixed so that the final tasks always run.
      // https://issues.redhat.com/browse/SRVKP-1724
      // Vincent Demeester
      Show
      * Before this update, if a pipeline had two parallel tasks that failed and one of them had `retries=2`, the final tasks never ran, and the Pipeline failed from a timeout. For example, the `pipelines-operator-subscription` task failed intermittently with an "Unable to connect to the server: EOF" error. With this update, the issue has been fixed so that the final tasks always run. // https://issues.redhat.com/browse/SRVKP-1724 // Vincent Demeester
    • Pipelines Sprint 210, Pipelines Sprint 211, Pipelines Sprint 212, Pipelines Sprint 215

      Expected behavior

      Final tasks are always executed

      Actual behavior

      In a pipeline with two parallel tasks where both fail and one of them has "retries=2", final tasks are never executed. Pipeline fails later because of timeout.

      Steps to reproduce

      apiVersion: tekton.dev/v1beta1
      kind: Task
      metadata:
        name: noop
      spec:
        params:
        - name: RETURN_CODE
          default: "0"
        steps:
          - name: sleep
            image: registry.access.redhat.com/ubi8/ubi-minimal
            script: |
              #!/usr/bin/env bash
              set -e
      
              echo "Will sleep for 2 seconds"
              sleep 2
      
              if [[ $(params.RETURN_CODE) != "0" ]]; then
                echo "Failure"
              else
                echo "Success"
              fi
      
              exit $(params.RETURN_CODE)
      
      apiVersion: tekton.dev/v1beta1
      kind: Pipeline
      metadata:
        name: test-finally
      spec:
        tasks:
        - name: test1
          taskRef:
            name: noop
          params:
            - name: RETURN_CODE
              value: "1"
          retries: 2
        - name: test2
          taskRef:
            name: noop
          params:
            - name: RETURN_CODE
              value: "1"
          # retries: 2
        finally:
          - name: cleanup
            taskRef:
              name: noop
      
      apiVersion: tekton.dev/v1beta1
      kind: PipelineRun
      metadata:
        generateName: test-finally-
      spec:
        pipelineRef:
          name: test-finally
        timeout: 2m
      

      Additonal information

      This pipeline works as expected when any of following changes

      1. task test2 succeeds
      2. both task1 and task2 have retries=2 (or any number)
      3. task test1 has retries=1, retries=0 or retries is omitted

              vdemeest Vincent Demeester
              ppitonak Pavol Pitoňák
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: