Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions pkg/reconciler/pipelinerun/pipelinerun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ spec:
conditions:
- lastTransitionTime: null
status: "True"
type: Succeeded
type: Succeeded
`), mustParseTaskRunWithObjectMeta(t, taskRunObjectMeta("test-pipeline-run-with-timeout-with-finally-hello-world-2", "foo", "test-pipeline-run-with-timeout-disabled",
"test-pipeline-with-finally", "hello-world-2", false), `
spec:
Expand Down Expand Up @@ -4317,7 +4317,7 @@ spec:
operator: in
values:
- aResultValue
# f-task is skipped because its parent task e-task is skipped because of missing result reference from a-task
# f-task not is skipped
- name: f-task
runAfter:
- e-task
Expand Down Expand Up @@ -4371,7 +4371,7 @@ spec:

wantEvents := []string{
"Normal Started",
"Normal Running Tasks Completed: 0 \\(Failed: 0, Cancelled 0\\), Incomplete: 2, Skipped: 4",
"Normal Running Tasks Completed: 0 \\(Failed: 0, Cancelled 0\\), Incomplete: 3, Skipped: 3",
}
pipelineRun, clients := prt.reconcileRun("foo", "test-pipeline-run-different-service-accs", wantEvents, false)

Expand Down Expand Up @@ -4426,24 +4426,21 @@ spec:
Values: []string{"bar"},
}},
}, {
// was attempted, but has missing results references
// its when expressions evaluate to false
Name: "e-task",
Reason: v1.MissingResultsSkip,
Reason: v1.WhenExpressionsSkip,
WhenExpressions: v1.WhenExpressions{{
Input: "$(tasks.a-task.results.aResult)",
Operator: "in",
Values: []string{"aResultValue"},
}},
}, {
Name: "f-task",
Reason: v1.ParentTasksSkip,
}}
if d := cmp.Diff(expectedSkippedTasks, actualSkippedTasks); d != "" {
t.Errorf("expected to find Skipped Tasks %v. Diff %s", expectedSkippedTasks, diff.PrintWantGot(d))
}

// confirm that there are no taskruns created for the skipped tasks
skippedTasks := []string{"a-task", "c-task", "e-task", "f-task"}
skippedTasks := []string{"a-task", "c-task", "e-task"}
for _, skippedTask := range skippedTasks {
labelSelector := fmt.Sprintf("tekton.dev/pipelineTask=%s,tekton.dev/pipelineRun=test-pipeline-run-different-service-accs", skippedTask)
actualSkippedTask, err := clients.Pipeline.TektonV1().TaskRuns("foo").List(prt.TestAssets.Ctx, metav1.ListOptions{
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,12 @@ func (t *ResolvedPipelineTask) skip(facts *PipelineRunFacts) TaskSkipStatus {
skippingReason = v1.GracefullyCancelledSkip
case facts.IsGracefullyStopped():
skippingReason = v1.GracefullyStoppedSkip
case t.skipBecauseWhenExpressionsEvaluatedToFalse(facts):
skippingReason = v1.WhenExpressionsSkip
case t.skipBecauseParentTaskWasSkipped(facts):
skippingReason = v1.ParentTasksSkip
case t.skipBecauseResultReferencesAreMissing(facts):
skippingReason = v1.MissingResultsSkip
case t.skipBecauseWhenExpressionsEvaluatedToFalse(facts):
skippingReason = v1.WhenExpressionsSkip
case t.skipBecausePipelineRunPipelineTimeoutReached(facts):
skippingReason = v1.PipelineTimedOutSkip
case t.skipBecausePipelineRunTasksTimeoutReached(facts):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,7 @@ func TestIsSkipped(t *testing.T) {
TaskSpec: &task.Spec,
},
}, {
// skipped because of parent task mytask22 was skipping because of missing result from grandparent task
// mytask11 which was skipped
// not skipped because of parent task mytask22 was skipping because when condition
PipelineTask: &v1.PipelineTask{
Name: "mytask23",
TaskRef: &v1.TaskRef{Name: "task"},
Expand All @@ -1099,7 +1098,7 @@ func TestIsSkipped(t *testing.T) {
"mytask20": true,
"mytask21": true,
"mytask22": true,
"mytask23": true,
"mytask23": false,
},
}, {
name: "pipeline-tasks-timeout-not-reached",
Expand Down
Loading