You want to know how to:
- add job notifiers on events other than on start or on completion
- add a notification if a job is running but takes too long
CloudBees CD (CloudBees Flow) currently supports onStart and onCompletion notifiers only.
There is a feature request to support an Event type for when something goes wrong (while the job is still running).
Until those features are supported, you can implement your own logic to achieve this behavior - see examples below.
- run a parallel “watch” step to keep track of the property you want
- have an onCompletion notifier in this step
- finish this step as soon as that property has reached some threshold value
- create a step-level notifier with a Custom condition
- define this condition such that it triggers upon a certain property value only - as described in the online help:
Only send mail if the condition evaluates to true. The condition is a string that is subject to property expansion. The notification will NOT be sent if the expanded string is “false” or “0”. If no condition is specified, the notification is ALWAYS sent.