Orbit tasks fail if the caller shell is not compatible with the `run` expected shell
octplane opened this issue Β· comments
We found out that when designing a simple task such as:
run
- |
cat > foo.yml <<EOF
app:
name: {{ $.Orbit.Values.app.name }}
EOF
it would fail for user having a shell not supporting this syntax (in my case, my fish
shell is not happy about that:
fish: Expected a string, but instead found a redirection
cat > foo.yml <<EOF
Hi @octplane!
Indeed, Orbit is checking the SHELL environment variable on POSIX systems.
I'd suggest to run Orbit like this:
$ SHELL=/bin/your_shell orbit run your_task
It should solve your problem π
If you don't want to specify the SHELL each time you're running Orbit, you could also have the following orbit.yml
file:
tasks:
- use: main_task
run:
- SHELL=/bin/your_shell orbit run sub_task
- use: sub_task
private: true
run:
- |
cat > foo.yml <<EOF
app:
name: {{ $.Orbit.Values.app.name }}
EOF
π
Actually this won't work with fish, because SHELL=/bin/your_shell
is not a valid env variable declaration.
Ok I didn't know about that. So your PR is actually relevant, you should re-open it π
I have made an alias for my shell I the mean time and this works well. Not sure this is necessary to add an useless
feature to the existing codebase for that kind of corner case. Maybe being more explicit about the default selected shell in the doc can make the trick.
I think this flag could serve for many other applications but not sure you want to apply this philosophy there too :) It could allow people to use other interpreters (such as ruby, python, ...) and have different shells for every task. This is also probably overkill...
I've updated the documentation to explain a bit about what's happening with shell selection: https://github.com/gulien/orbit/tree/documentation
Your PR is interesting because it allows to override the default behaviour π