Health check for deployments/environments
Description
I would like Gitlab to tell me whether my deployment was successful and if my environment is healthy.
Proposal
Allow CI deployment jobs to specify a script that can be used to verify that a deployment/environment is healthy. Do this by adding a healthcheck
property or similar to the job, possibly within the environment
section. Periodically execute this script via the deployment's CI runner to verify that the deployment is healthy.
Solving the issue this way does require changes to the Gitlab Runner as well as to Gitlab, but it is a solution that is flexible without compromising security. If the check is executed by the runner, the security concerns are no different from those of the CI job. If the check is executed by Gitlab, then either the check would need to be less flexible (something other than a script), or the security concerns become huge (arbitrary script execution). Most deployments could probably be checked with a simple HTTP(S) request and some verification constraints (legal response codes, regex to ensure a good response, etc), but others would be more complicated. One of my more important deployments is an AMQP message broker (RabbitMQ). I think executing the check with the CI job's runner is far more elegant and far less headache in the long run.