Why does one of these work while the other doesnt?

The workflow below fails when run with command but succeeds when run with script. The command way is unable to recognize the args var. Can anyone explain why? As a side question, when should I reach for script as opposed to command, or vice versa? I’ve seen suuuuper slow run times when running a garden command via a script. In other words, doing script: garden run task foo as opposed to command: [run, task, foobar]. Can anyone think of a reason why?

The workflow:

  - description: Wipe the database and re-apply migrations
    # command: [run, task, prisma, --var, args="migrate reset -f --skip-generate"]
    script: garden run task prisma --var args="migrate reset -f --skip-generate"

The task:

  - name: prisma
    command: [/bin/sh, -c]
    args: ["pnpm exec prisma ${var.args || '-h'}"]
      max: 4096
      max: 4000
      - postgres
    env: &env
      DATABASE_URL: "postgresql://${var.postgres-username}:${var.postgres-password}@${var.postgres-host}:${var.postgres-port}/${var.postgres-database}??connect_timeout=300"

I’m especially confused because I once had a custom command like this that worked great:

kind: Command
name: reset-db
  short: Wipe the postgres database and re-apply migrations
  - run
  - task
  - prisma
  - --var
  - args="migrate reset -f ${join(args["--"], " ")}"

Hi @thatvegandev! Looks like you have already reported this as a GitHub issue vars not passed via `command` in workflows · Issue #3286 · garden-io/garden · GitHub, please confirm. The issue https://github.com/garden-io/garden/issues/3287 also looks relevant.

We’ll take a look soon. Let’s continue tracking the progress in GitHub.

This topic was automatically closed after 12 days. New replies are no longer allowed.