Notifications¶
The Notifications module allows you to configure Jenkins to notify other applications about various build phases. It requires the Jenkins notification plugin.
- Component: notifications
- Macro:
notification
- Entry Point:
jenkins_jobs.notifications
- class notifications.Notifications(registry)¶
- component_list_type = 'notifications'¶
The component list type will be used to look up possible implementations of the component type via entry points (entry points provide a list of components, so it should be plural). Set both component_type and component_list_type to None if module doesn’t have components.
- component_type = 'notification'¶
The component type for components of this module. This will be used to look for macros (they are defined singularly, and should not be plural). Set both component_type and component_list_type to None if module doesn’t have components.
- gen_xml(xml_parent, data)¶
Update the XML element tree based on YAML data. Override this method to add elements to the XML output. Create new Element objects and add them to the xml_parent. The YAML data structure must not be modified.
:arg class:xml.etree.ElementTree xml_parent: the parent XML element :arg dict data: the YAML data structure
- sequence = 22¶
The sequence number for the module. Modules are invoked in the order of their sequence number in order to produce consistently ordered XML output.
- http()¶
Defines an HTTP notification endpoint.
Requires the Jenkins Notification Plugin.
- Parameters:
format (str) – notification payload format, JSON (default) or XML
event (str) – job events that trigger notifications: started, completed, finalized or all (default)
url (str) – URL of the endpoint
timeout (int) – Timeout in milliseconds for sending notification request (30 seconds by default)
retries (int) – Nr of times to retry sending notification in case sending notification fails. (0 by default)
log (int) – Number lines of log messages to send (0 by default). Use -1 for all (use with caution).
Example:
notifications: - http: url: http://example.com/jenkins_endpoint format: xml event: completed timeout: 40000 log: -1 retries: 5