community
community copied to clipboard
service: pause pipeline until service(s) listening on port(s)
Description
Right now users are free to use services in their pipelines but they're at the mercy of the startup time of those services to be faster than their step else incur an overhead of having to sleep
or use something like a wait-for-it style script. This feature could be added as some sort of Vela plugin that just wraps that script but it would be nicer if the platform supported it in the YAML definition somehow and took care of that particular nuance.
Example
services:
- name: postgres
image: postgres
ready_when:
- type: tcp-port
timeout: 10s
port:
- 5432
- 1234
- ...
Value
This reduces the complexity of user pipelines as they're no longer required to add dummy steps for waiting on service availability or having to make the same script available in all pipelines and repos.
Definition of Done
Users can define services in their pipeline and "just use" them in their steps without having to think about if a service started too soon or not. They can know that before a particular step runs that a service is either up and running or the build has failed itself due to a service startup failure.
For the kubernetes runtime, we can use kubernetes primitives to provide this feature.
We might also want to model the pipeline yaml on how k8s defines it as that has been battle tested.