runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.82k stars 1.06k forks source link

Allow Specifying Custom Script Runner #1417

Closed oliverisaac closed 5 days ago

oliverisaac commented 3 years ago

It'd be handy if we could set an env var or config option to use bash instead of sh when running commands:

https://github.com/runatlantis/atlantis/blob/4fc136c048c7489b12fefceed8563a96ac20054b/server/events/runtime/run_step_runner.go#L35

acastle commented 3 years ago

This is a simple enough feature to be added. Albeit it is a little convoluted, I believe you could accomplish this currently by wrapping your commands with bash -c "<command>"

oliverisaac commented 3 years ago

For simple scripts that's fine but for more complex scripts the quoting can get bothersome.

I ended up customizing our atlantis image so that /bin/sh symlinks to /bin/bash and it works the way I want, so this is super low priority all things considered :)

anryko commented 1 month ago

I run into the similar issues and would be interested in implementing this feature. I was thinking of extending the run.command interface to:

Replacing sh -c "command" with bash -c "command", or other shells/interpreters (e.g. python -c "command"):

- run:
    command: |
      # my bash script
    output: hide
    shell: bash

What do you think?