garden icon indicating copy to clipboard operation
garden copied to clipboard

Crash: Custom commands cause crash in `garden dev` shell: Missing cli argument in custom command wrapper.

Open shumailxyz opened this issue 1 year ago • 3 comments

Garden Bonsai (0.13) Bug

Current Behavior

Custom commands that use gardenCommand do not work in dev mode and throw an error:

Missing cli argument in custom command wrapper.
This is a bug. Please report it!

Screenshot 2023-06-20 at 12 24 41

Expected behavior

Custom garden commands should work just fine in dev mode.

Reproducible example

Workaround

Use following commands.garden.yml and try to run c in dev mode.

kind: Command
name: echo
description:
  short: Just echo a string
exec:
  command:
    - sh
    - -c
    - echo "hello world"

---

kind: Command
name: c
description:
  short: Run validate cmd
gardenCommand:
  - validate
 

garden version: 0.13.2

shumailxyz avatar Jun 20 '23 10:06 shumailxyz

Draft PR for this: https://github.com/garden-io/garden/pull/4679

However, that doesn't address the issue properly and breaks the rendering of logs in dev REPL. The custom command wrapper performs a full run of garden command via GardenCli.run() and that initializes the logger multiple times. This needs to be addressed more carefully.

Until this is fixed, the workaround is to use custom garden command outside dev mode.

shumailxyz avatar Jul 03 '23 14:07 shumailxyz

Might be related to https://github.com/garden-io/garden/issues/4116

shumailxyz avatar Jul 13 '23 11:07 shumailxyz

I hit this bug.

Error: Missing cli argument in custom command wrapper.
    at CustomCommandWrapper.action (/snapshot/pkg/core/build/src/commands/custom.js:164:23)
    at /snapshot/pkg/core/build/src/commands/base.js:213:41
    at async /snapshot/pkg/core/build/src/util/open-telemetry/spans.js:46:20

We have a custom uproot command that behaves like delete services used to (it doesn't remove PersistentVolumeClaims); I tried running the command from the interactive console (launched by garden deploy — the deploy was completed).

stilist avatar Oct 10 '23 15:10 stilist