Skip to content

Commit 584627a

Browse files
committed
fix: Move when condition to higher priority
When using "when" condition in pipelinerun definition we can sometime get into a situation when a task would be skipped due to "when" condition but instead it is skipped either by parent is skipped or result reference is missing. This behaviour has a negative impact on the rest of the tasks in the pipeline. A good example of this issue is represented by this pipeline: A -> B -> C In case B depends on A's result and both A and B uses when condition that both evaluates to false the C is automatically skipped with "Parent Tasks were skipped" even-though C doesn't depend on any previous results. With this change both A and B are skipped by evaluating the "when" condition and C is executed as expected. This commit address the bug #7680. Signed-off-by: Ales Raszka <[email protected]>
1 parent 783c11a commit 584627a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,12 @@ func (t *ResolvedPipelineTask) skip(facts *PipelineRunFacts) TaskSkipStatus {
357357
skippingReason = v1.GracefullyCancelledSkip
358358
case facts.IsGracefullyStopped():
359359
skippingReason = v1.GracefullyStoppedSkip
360+
case t.skipBecauseWhenExpressionsEvaluatedToFalse(facts):
361+
skippingReason = v1.WhenExpressionsSkip
360362
case t.skipBecauseParentTaskWasSkipped(facts):
361363
skippingReason = v1.ParentTasksSkip
362364
case t.skipBecauseResultReferencesAreMissing(facts):
363365
skippingReason = v1.MissingResultsSkip
364-
case t.skipBecauseWhenExpressionsEvaluatedToFalse(facts):
365-
skippingReason = v1.WhenExpressionsSkip
366366
case t.skipBecausePipelineRunPipelineTimeoutReached(facts):
367367
skippingReason = v1.PipelineTimedOutSkip
368368
case t.skipBecausePipelineRunTasksTimeoutReached(facts):

0 commit comments

Comments
 (0)