Default branch: After merging, send pipeline error notifications to a mailing list

Hi all,

  • I’m developing code with a bunch of people.
  • To communicate, we use a mailing list.
  • If people create a MR, pipeline error notifications should be send to the commit author(s).
  • After merging to the default branch, possible pipeline error notifications should be send to the mailing list.

I’ve researched this topic and how to achieve this, in a simple, native way within GitLab, but failed to find a solution. Some ideas I had and investigated:

  • Settings -> Integrations -> Pipeline emails: It seems it’s not possible to filter by branch, which I would need, if I’m not mistaken.

  • I’ve got a special “bot account”, with the email of the mailing list, which got a schedule associated to build the default branch pipeline regularly. This works as expected, but I would like to run this schedule as well right after merging a branch. Therefore, I thought about using ‘only’ and ‘except’ within .gitlab-ci.yaml, adding another job with just uses ‘curl’ to trigger the schedule of the bot. But how would I define the following configuration:

    • Multiple jobs should be run if commit is not pushed to the default branch, i.e. ‘master’.
    • These jobs shouldn’t run if merged to the default branch, i.e. ‘master’.
    • But these jobs should be run if triggered via a schedule (the schedule of the bot).

    The idea is to prevent the jobs being executed twice after merging: Once just by the merge event, notifying the commit author(s), and once for the bot schedule. I would like to only achieve the later.

I hope it’s possible to understand the above and what I’m trying to achieve, if something is unclear, please say so.

Looking forward to your feedback!
Thanks!

Is it currently possible, to run a job if

  • code is pushed to a branch != master
    OR
  • is called via a trigger on branch = master

Any idea on this? Is something along the lines as described above possible nowadays.