pipeline: Conditionals: Configure what happens when a task is skipped due to condition failure

Expected Behavior

Users can decide to either run or skip tasks that are dependent on the task that was skipped due to a condition check failure.

Actual Behavior

Tasks that are dependent on a skipped task are always skipped

Steps to Reproduce the Problem

  1. Create a pipeline like similar to this:
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: two-tasks-one-condition
spec:
  tasks:
  - name: conditional-task
    taskRef:
      name: task1
    conditions:
      - conditionRef: always-fail
  - name: run-if-1-or-1-skipped
    taskRef:
      name: task2
    runAfter:
      - conditional-task
  1. Run the pipeline through a PipelineRun
  2. task2 is not executed

Additional Info

  1. Might be worth enumerating the use cases for this feature before implementing this.
  2. Based on discussion from #27: https://docs.google.com/a/google.com/document/d/1iTb0rDDlgQcPbiYIGJ-atkaML8aCyPCyhfucCPJmNLs/edit?disco=AAAADD1TnxU

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 24 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@Bl4d3s we paused that work for a bit as we discussed some design choices and alternatives in https://github.com/tektoncd/pipeline/issues/3345 – rebasing the pr now ~and planning to get it in before the v0.18 release~ (revisited syntax in https://github.com/tektoncd/community/pull/258)

@jerop I really could use the feature you implemented in the PR. is there any ETA when this will be merged? If I can help with anything to speed things up, I can always take a look.

My use case:

  1. Unit and Integration-Tests are executed
  2. Optional additional tasks if systemtests or similar need to be executed (guarded with when expression)
  3. Task collecting all test results from workspace (has to be after 2. obviously, but is not dependent on it)

One thought after looking at #1137 :

  • If a Task is getting a resource from a Task that has a failing condition, I’m not sure it makes any sense to run that dependent Task: e.g. if a Task is building an image as an output, and another task wants to get the built image (digest) from that Task, it wouldn’t make sense to run it anyway
  • runAfter is fuzzier - if it’s just a matter of ordering, it feels like the user could potentially choose whether the tasks “after” should be skipped or not