Skip to content

Commit

Permalink
fix(core): no longer crashing app on Flow triggers without condition
Browse files Browse the repository at this point in the history
closes #2060
  • Loading branch information
brian-mulier-p committed Sep 8, 2023
1 parent 92b1c21 commit e0e30ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public List<Execution> computeExecutionsFromFlowTriggers(Execution execution, Li
.flatMap(flow -> flowTriggers(flow).map(trigger -> new FlowWithFlowTrigger(flow, trigger)))
.filter(flowWithFlowTrigger -> conditionService.valid(
flowWithFlowTrigger.getFlow(),
flowWithFlowTrigger.getTrigger().getConditions().stream()
Optional.ofNullable(flowWithFlowTrigger.getTrigger().getConditions()).stream().flatMap(Collection::stream)
.filter(Predicate.not(MultipleCondition.class::isInstance))
.toList(),
conditionService.conditionContext(
Expand All @@ -67,7 +67,7 @@ public List<Execution> computeExecutionsFromFlowTriggers(Execution execution, Li
if (multipleConditionStorage.isPresent()) {
List<FlowWithFlowTriggerAndMultipleCondition> flowWithMultipleConditionsToEvaluate = validTriggersBeforeMultipleConditionEval.stream()
.flatMap(flowWithFlowTrigger ->
flowWithFlowTrigger.getTrigger().getConditions().stream()
Optional.ofNullable(flowWithFlowTrigger.getTrigger().getConditions()).stream().flatMap(Collection::stream)
.filter(MultipleCondition.class::isInstance)
.map(MultipleCondition.class::cast)
.map(multipleCondition -> new FlowWithFlowTriggerAndMultipleCondition(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
id: trigger-flow-listener-no-condition
namespace: io.kestra.tests

inputs:
- name: from-parent
type: STRING

tasks:
- id: only-listener
type: io.kestra.core.tasks.debugs.Return
format: "childs: {{inputs['from-parent']}}"

triggers:
- id: listen-flow
type: io.kestra.core.models.triggers.types.Flow
inputs:
from-parent: '{{ outputs.only.value }}'

0 comments on commit e0e30ab

Please sign in to comment.