flowpipe icon indicating copy to clipboard operation
flowpipe copied to clipboard

When using `if` and `loop` together, the `if` only seems to apply to the first iteration.

Open graza-io opened this issue 1 year ago • 0 comments

I would expect that the below would result in the step test not being run, but seemingly it runs.

mod "local" {
  title = "if-loop"
}

pipeline "test" {

  param "messages" {
    type = list(string)
    default = ["a", "b", "c"]
  }

  step "message" "test" {
    notifier = notifier["default"]
    if = false
    loop {
      until = loop.index == length(param.messages)-1
    }
    text = param.messages[loop.index]
  }
}

Output:

❯ flowpipe pipeline run test
[flowpipe] Execution ID: exec_cpp8ubqhc8a7fgmhlkdg
[test] Starting pipeline
[test.test[0]] Skipped
[test.test[1]] Starting message: b
[test.test[1]] Arg text = b
[test.test[1]] Complete 1ms
[test.test[2]] Starting message: c
[test.test[2]] Arg text = c
[test.test[2]] Complete 0ms
[test] Complete 52ms exec_cpp8ubqhc8a7fgmhlkdg

graza-io avatar Jun 19 '24 08:06 graza-io