turbot / flowpipe

Flowpipe is a cloud scripting engine. Automation and workflow to connect your clouds to the people, systems and data that matters.
https://flowpipe.io
GNU Affero General Public License v3.0
361 stars 13 forks source link

Cannot use an expression in max_concurrency? #800

Closed e-gineer closed 6 months ago

e-gineer commented 6 months ago

I'd like to use an expression in max_concurrency for a step:

pipeline "multi_step" {

  param "prompt" {
    default = "Do you approve?"
  }

  param "subject" {
    default = "Do you approve?"
  }

  param "approvers" {
    default = ["default"]
  }

  step "input" "approve" {
    for_each = param.approvers

    # This doesn't work as of v0.4.0, but should make
    # inputs run in serial.
    max_concurrency = param.parallel ? null : 1

    notifier = notifier[each.value]

    type = "button"

    subject = param.subject

    prompt = param.prompt

    option "approve" {
      label = "Approve"
      style = "ok"
    }

    option "deny" {
      label = "Deny"
      style = "alert"
    }

  }

But it fails with:

2024-03-15 06:50:10 [flowpipe] error Failed watching workspace for mod mod.approval: failed to reload workspace: Internal Error: Failed to decode mod: Expression not allowed in max_concurrency
vhadianto commented 6 months ago

Will be included in v0.4.2-rc.3

Fixed verified with the following pipeline:

pipeline "lots_of_sleep_bound_with_param" {
    param "concurrency" {
        default = 1
    }

    param "parallel" {
        default = false
    }

    step "sleep" "lots_of_them" {
        for_each = [1, 2, 3, 4, 5, 6, 7, 8, 9]
        max_concurrency = param.parallel ? null : 1
        duration = "2s"
    }
}