not sure if this answers your question, but I think you could modify the yaml as shown below to achieve the behavior you desire …
First, we use the
depends_on attribute to define the pipeline ordering. By default, pipelines execute in parallel, however, the
depends_on value can be used to define an execution graph.
Next, we use the
trigger section to ensure the notification pipeline is only executed when the build is in a failing state. If the first pipeline fails, the overall build state would be failing, and the notification pipeline would execute.
Note that there are two statuses – the status of the overall build (all pipelines) and the status of the currently executing pipeline. I am not sure which status the email plugin will use (this is a third party plugin, so it depends on what the author chose) but you can likely customize the email subject and message to communicate that the build failed.
- name: notify
+ - failure
+ - default