feat: flag to select shell to use in adhoc scripts
Currently, spread assumes that the default shell is Bourne-like (perhaps specifically bash?) and runs adhoc scripts with whatever that default shell currently is. I recently changed my default shell from zsh to fish, and this broke a spread test for me.
Example:
multipass:
type: adhoc
allocate: |
# something that works in zsh, but not fish
COUNT="1"; echo $(($COUNT + 1))
# the fish equivalent for convenience
# set COUNT "1"; echo $(math $COUNT + 1)
Running a spread task with this config in zsh will work, but if your default shell is fish then you'll get fish errors:
++ COUNT="1"; echo $(($COUNT + 1))
fish: Unsupported use of '='. In fish, please use 'set COUNT "1"'.
COUNT="1"; echo $(($COUNT + 1))
^~~~~~~~^
I think it would be useful to have another parameter that could be set on these scripts:
multipass:
type: adhoc
shell: /usr/bin/bash
allocate: |
...
My 2c:
Let's have spread invoke the shell of spread's choice and document what that is. My choice would be the lowest common denominator, dash that comes with any Ubuntu.
If the tool lets users choose a shell, then reusing these yaml files gets complicated as every engineer needs to learn N-1 shells that other engineers use.