[teregen] Add notification about errors in template generating
Often, there is a problem inside incident which cause the template not to be generated and the error is not spotted until someone needs the template. Then, one need to login to the server to view the logs and to find out the reason (usually a missing product definition). If the issue is easily fixable, one need to wait for MR to be merged and deployed and for template generator to pick up those changes during next runs. This might cause a delay.
I propose to make a proactive approach and notify on errors (RC channel would be probably a good idea) to allow faster reaction to problematic templates. To minimize spam, each error should be sent only once. As the template generator is not stateless (with introducing the test coverage feature), this should be no longer a problem to implement. Proof of concept how to send messages to RC already exists and the bot account should be also already active.
Things to consider:
- Sent notification storage (psql is already used elsewhere in the template generator)
- Outgoing hook implementation (can be part of a process -- output plugin; or wrapper script watching for return code)
- RC Bot integration (could send messages directly or through another service to allow interaction)