spin
spin copied to clipboard
(Discussion): allow multi trigger to continue if a trigger exits successfully
To enable running other triggers along with the command
trigger as per https://github.com/fermyon/spin-trigger-command/issues/7
This PR just focuses on enabling the ability for multi-triggers to continue if one of them exits successfully.
I'm not sure this is the right default. For most triggers, if the trigger is no longer accepting events, the application is not doing what you want it to do, and should exit.
We have various options here. I thought of:
- Do this and hope that no eventful trigger ever exits with code 0.
- Have a manifest setting where the developer can mark a trigger as "continue after exit".
- Add a field to the trigger launch metadata where a trigger can report itself as "expect me to terminate and continue without me".
I am wary of 1. 3 is convenient for application developers which is nice, but I don't know if it provides enough flexibility for the command use case (what if someone writes a side-car-like command that is expected to stay up for the lifetime of the application? We can't assume init containers are the only use case for this). 2 feels like a tedious task that the app developer has to remember to do every time. Any other ideas?
Looking at the original issue, it also seems to express a requirement that (in the author's particular case), the other triggers do not start until the command trigger has successfully exited. If that's the case, we'll need significantly greater structural changes...
Those are some valid concerns, if we do not want to rely on triggers being well-behaved. I like the explicitness of option 2, it also potentially sets a way for the manifest to also define if certain triggers need to be run serially or parallelly.
https://github.com/fermyon/spin-trigger-command/issues/7#issuecomment-2035572411
Another option would be a e.g.
--sleep-forever-on-completion flag
that causes this trigger to...sleep forever on completion. If all its resources were dropped before sleeping this process would likely have very little overhead.