-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Tracking discussions about When Expressions Status, particularly:
- how to use the current knative's
ConditionSucceededin When Expressions - introducing a
ConditionsSkippedtype to use in place ofConditionSucceeded
Ran a simple PipelineRun with one task with
whenexpression evaluating tofalsewhich resulted in a TaskRun with statusfailedsimilar to what happens when the condition fails for a task (statusfailedwithConditionCheckFailed).apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: pipelinerun-to-skip-task spec: pipelineSpec: tasks: - name: skip-this-task when: - input: "foo" operator: notin values: ["foo"] taskSpec: steps: - name: echo image: ubuntu script: | echo "Good Night!"$ tkn pr describe pipelinerun-to-skip-task Name: pipelinerun-to-skip-task Labels: tekton.dev/pipeline=pipelinerun-to-skip-task 🌡️ Status STARTED DURATION STATUS 1 minute ago 0 seconds Succeeded(Completed) 🗂 Taskruns NAME TASK NAME STARTED DURATION STATUS ∙ pipelinerun-to-skip-task-skip-this-task-25tgt skip-this-task --- --- Failed(WhenExpressionsEvaluatedToFalse)But the way users might start using
whenexpressions would be to skip or ignore a task based on the param which was not possible before without writing conditions. For an ignore use case, the statusfailedmight not make sense. Also, thetaskrunwhich is listed here is just thetaskrunobject created as part of thepipelinerunstatus not actualtaskrunwhich can not be described anyways:tkn tr describe pipelinerun-to-skip-task-skip-this-task-25tgt Error: failed to get TaskRun pipelinerun-to-skip-task-skip-this-task-25tgt: taskruns.tekton.dev "pipelinerun-to-skip-task-skip-this-task-25tgt" not found@bobcatfish how about changing this status
failedto something different to signify that the task wasskipped? But then in that case, we have to also think about the tasks which are dependent on this skipped/ignored task. Those tasks are also skipped but are not part of the overallpipelinerunstatus and does not show up in the list ofTaskruns.
@pritidesai thanks for looking into this! currently, knative only provides
ConditionTrue,ConditionFalse, andConditionUnknownforConditionSucceeded. Had gone withConditionFalsebut open to hearing arguments for using the other options.I've now updated it to our own status
ConditionSkipped:const ( ConditionSkipped corev1.ConditionStatus = "Skipped" ) prtrs.Status.SetCondition(&apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionStatus(ConditionSkipped), Reason: resources.ReasonWhenExpressionsEvaluatedToFalse, Message: fmt.Sprintf("When Expressions for Task %s in PipelineRun %s evaluated to False", rprt.TaskRunName, pr.Name), })That gives this result in your example:
$ kubectl describe pipelineruns.tekton.dev pipelinerun-to-skip-task Name: pipelinerun-to-skip-task Namespace: default Labels: tekton.dev/pipeline=pipelinerun-to-skip-task API Version: tekton.dev/v1beta1 Kind: PipelineRun Spec: Pipeline Spec: Tasks: Name: skip-this-task Task Spec: Metadata: Steps: Image: ubuntu Name: echo Resources: Script: echo "Good Night!" When: Input: foo Operator: notin Values: foo Timeout: 1h0m0s Status: Completion Time: 2020-08-26T12:02:08Z Conditions: Last Transition Time: 2020-08-26T12:02:08Z Message: Tasks Completed: 0 (Failed: 0, Cancelled 0), Skipped: 1 Reason: Completed Status: True Type: Succeeded Pipeline Spec: Tasks: Name: skip-this-task Task Spec: Metadata: Steps: Image: ubuntu Name: echo Resources: Script: echo "Good Night!" When: Input: foo Operator: notin Values: foo Start Time: 2020-08-26T12:02:08Z Task Runs: Pipelinerun - To - Skip - Task - Skip - This - Task - Phpfz: Pipeline Task Name: skip-this-task Status: Conditions: Last Transition Time: 2020-08-26T12:02:08Z Message: When Expressions for Task pipelinerun-to-skip-task-skip-this-task-phpfz in PipelineRun pipelinerun-to-skip-task evaluated to False Reason: WhenExpressionsEvaluatedToFalse Status: Skipped Type: Succeeded Pod Name: When Expressions Status: Evaluation Results: Expression: Input: foo Operator: notin Values: foo Result: false Execute: false Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Started 3m32s PipelineRun Normal Succeeded 3m32s PipelineRun Tasks Completed: 0 (Failed: 0, Cancelled 0), Skipped: 1$ tkn pr describe pipelinerun-to-skip-task Name: pipelinerun-to-skip-task Namespace: default 🌡️ Status STARTED DURATION STATUS 18 seconds ago 0 seconds Succeeded(Completed) 📦 Resources No resources ⚓ Params No params 🗂 Taskruns NAME TASK NAME STARTED DURATION STATUS ∙ pipelinerun-to-skip-task-skip-this-task-phpfz skip-this-task --- --- (WhenExpressionsEvaluatedToFalse)@pritidesai @bobcatfish what do you think? will add what we decide on about the status to the TEP
@pritidesai @jerop that's a good point about "failed".
one option would be implementing this PR with the same behavior as we use for existing Conditions, and then separately deciding how we want to handle this in the future? that would mean the potential for a backwards incompatible change though.
i dont want to change the behavior of our existing condition - one reason we implemented it the way we did was to satisfy knative duck typing
if anything, id like to see the addition of a new condition specifically for skipped. and perhaps in that case we do not include ConditionSucceeded at all? the fact that we have a few options here makes me want to suggest that we separate that discussion from this PR if we can - i could also see making a separate TEP about it to make sure we explore the options well
/assign