I'm aware of this feature, but had no luck using it as a build time dependency (we are trying to run a command locally and use it as a docker image build arg):
https://docs.garden.io/using-garden/variables-and-templating#runtime-outputs
Currently we have a workaround to define the command as the build command for the exec module and add the module as a build dependency to the container module.
Can we achieve this without writing things to a file? Does bonsai already solve this?