Closed moensch closed 6 years ago
Because we have to support a wide variety of shells I think we're unlikely to do this. We have to handle each shell and figure out what env are exported to make them available to other hooks, I think adding functions would introduce too much complexity and we'd prefer folks handled shared code other ways.
Sounds like you are headed in the right direction with plugins! Check out https://github.com/buildkite-plugins/library-example-buildkite-plugin if you haven't seen it.
I'm going to close this one for now, feel free to let us know if I've missed something.
Oh - I did vaguely think about that as a use case (overriding $PATH
) - that makes so much sense. Thank you. This solves my specific problem exactly (provide commands without taking over as a command
hook).
Within pre-command hooks I can
export
variables and that's all fine. But if I export a function viaexport -f func_name
it is then not available to the command step.I have worked around this for now by converting the plugin I wrote to provide the bash func from a pre-command to a command hook (where the hook declares the function and calls
export -f
) and then simply callseval "$BUILDKITE_COMMAND"
.Though command hooks are rather limiting (no more than one).