Currently when a pipeline completes or errors the submitter of the pipeline is notified via email. With automated pipelines an automation bot is the submitter of the pipeline. Since we can't send an email to an automation bot, managers (owners and maintainers) of the namespace the pipeline was launched from should receive an email
Acceptance criteria
Pipeline mailer updated to check if user is an automation bot or a regular user
If submitter is an automation bot, send emails to the namespace managers, otherwise send email to the submitter as is done currently
Test emails are sent to the managers if the submitter is an automation bot.
Note: When a project is created an automation bot is automatically created as well. The user can be retrieved in the rails console with PROJECT.namespace.bots.where(user_type: User.user_types[:project_automation_bot]
Summary
Currently when a pipeline completes or errors the submitter of the pipeline is notified via email. With automated pipelines an automation bot is the submitter of the pipeline. Since we can't send an email to an automation bot, managers (owners and maintainers) of the namespace the pipeline was launched from should receive an email
Acceptance criteria
Note: When a project is created an automation bot is automatically created as well. The user can be retrieved in the rails console with
PROJECT.namespace.bots.where(user_type: User.user_types[:project_automation_bot]