Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Exec action spec.shell does not accept a shell specified as a string #6576

Open
WillDaSilva opened this issue Oct 24, 2024 · 1 comment
Assignees
Labels

Comments

@WillDaSilva
Copy link

Bug

Current behavior

The documentation for spec.shell for every kind of exec action says:

If true, runs file inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.

Expected behavior

It's unclear where/how "a different shell can be specified as a string". This issue is either a documentation bug if this feature – using a different shell – is supported but poorly documented, or a bug in the code if the spec.shell field is meant to accept strings.

Reproducible example

kind: Run
name: mre
type: exec
spec:
  shell: "bash"
  command:
    - >
      echo "your command here"
Error validating spec for Run type=exec name=mre:

At path spec.shell: Expected boolean, received string

Workaround

Use spec.shell: false, and then manually call the alternative shell in spec.command:

spec:
  shell: false
  command:
    - "bash"
    - "-c"
    - >
      echo "your command here"

Suggested solution(s)

Make spec.shell a boolean | string field, and have it interpret string values as the name/path of the shell that will be used. An example added to the documentation would be nice too.

Your environment

  • OS: macOS
  • How I'm running Kubernetes: AWS EKS

garden version: 0.13.42

@thsig
Copy link
Collaborator

thsig commented Oct 29, 2024

Hi @WillDaSilva! Thanks for reporting this.

We should fix both the docs and the functionality in this case—we should allow shell to be a boolean or a string (with the boolean true using the default shell for the platform, whereas a string would specify the shell to use).

We should also support specifying the command as a string instead of an array.

I'll keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants