Email notifications for Sloth CI apps
Project description
Send email notifications when builds complete or fail.
Executing actions of an app is called *build*. A build is considered *completed* if all its actions were completed. If some actions were completed and some failed, it's a *partially completed*; if all actions fail, the build *failed*.
This extension sends you emails via SMTP when your builds complete (fully or partially) or fail; just pick the desired notification level, list the recepient emails, and enter your SMTP credentials. Optionally, you can set the subject for each notifcation level.
.. warning::
This extension uses `SMTPHandler <https://docs.python.org/3/library/logging.handlers.html#smtphandler>`__ from logging.handlers. SMTPHandler doesn't work with GMail because it creates an smtplib.SMTP object to connect to the host, whereas GMail requires smtplib.SMTP_SSL.
Outlook.com works fine.
Installation
------------
.. code-block:: bash
$ pip install sloth-ci.ext.build_email_notifications
Usage
-----
.. code-block:: yaml
:caption: build_email_notifications.yml
extensions:
notifications:
# Use the module sloth_ci.ext.build_email_notifications.
module: build_email_notifications
# Emails to send the notifications to.
emails:
- foo@bar.com
- admin@example.com
# Log level (number or valid Python logging level name).
# ERROR includes only build fails, WARNING adds partial completions,
# INFO adds completion, and DEBUG adds trigger notifications.
# Default is WARNING.
level: INFO
# The "from" address in the emails. Default is "build@sloth.ci."
from: notify@example.com
# The email subject on build trigger. You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Triggered."
subject_triggered: 'Triggered build on {listen_point}!'
# The email subject on build completion.You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Completed."
subject_completed: 'Hooray! {listen_point} works!'
# The email subject on build partial completion. You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Partially Completed."
subject_partially_completed: 'Better than nothing on {listen_point}'
# The email subject on build fail. You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Failed."
subject_failed: 'Fail on {listen_point}'
# SMTP settings.
# SMTP mail host and (if not default) port.
# Mandatory parameter.
mailhost: 'smtp-mail.outlook.com:25'
# SMTP login.
login: foo@bar.baz
# SMTP password.
password: bar
# If the SMTP server requires TLS, set this to true. Default is false.
# If necessary, you can provide a keyfile name or a keyfile and a certificate file names.
# This param is used only if the login and password params are supplied.
secure: true
# secure:
# - keyfile
# - cerfile
Executing actions of an app is called *build*. A build is considered *completed* if all its actions were completed. If some actions were completed and some failed, it's a *partially completed*; if all actions fail, the build *failed*.
This extension sends you emails via SMTP when your builds complete (fully or partially) or fail; just pick the desired notification level, list the recepient emails, and enter your SMTP credentials. Optionally, you can set the subject for each notifcation level.
.. warning::
This extension uses `SMTPHandler <https://docs.python.org/3/library/logging.handlers.html#smtphandler>`__ from logging.handlers. SMTPHandler doesn't work with GMail because it creates an smtplib.SMTP object to connect to the host, whereas GMail requires smtplib.SMTP_SSL.
Outlook.com works fine.
Installation
------------
.. code-block:: bash
$ pip install sloth-ci.ext.build_email_notifications
Usage
-----
.. code-block:: yaml
:caption: build_email_notifications.yml
extensions:
notifications:
# Use the module sloth_ci.ext.build_email_notifications.
module: build_email_notifications
# Emails to send the notifications to.
emails:
- foo@bar.com
- admin@example.com
# Log level (number or valid Python logging level name).
# ERROR includes only build fails, WARNING adds partial completions,
# INFO adds completion, and DEBUG adds trigger notifications.
# Default is WARNING.
level: INFO
# The "from" address in the emails. Default is "build@sloth.ci."
from: notify@example.com
# The email subject on build trigger. You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Triggered."
subject_triggered: 'Triggered build on {listen_point}!'
# The email subject on build completion.You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Completed."
subject_completed: 'Hooray! {listen_point} works!'
# The email subject on build partial completion. You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Partially Completed."
subject_partially_completed: 'Better than nothing on {listen_point}'
# The email subject on build fail. You can use the {listen_point} placeholder.
# Default is "{listen_point}: Build Failed."
subject_failed: 'Fail on {listen_point}'
# SMTP settings.
# SMTP mail host and (if not default) port.
# Mandatory parameter.
mailhost: 'smtp-mail.outlook.com:25'
# SMTP login.
login: foo@bar.baz
# SMTP password.
password: bar
# If the SMTP server requires TLS, set this to true. Default is false.
# If necessary, you can provide a keyfile name or a keyfile and a certificate file names.
# This param is used only if the login and password params are supplied.
secure: true
# secure:
# - keyfile
# - cerfile
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for sloth-ci.ext.build_email_notifications-1.0.7.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9c8e1cc793dfdf08029bc130998bd7ae9607bffa0deb7d0cac88a48d26a0b77 |
|
MD5 | 70a03c10c5f3669fe7ecf03ad6bf0d06 |
|
BLAKE2b-256 | d2b495d8bb61fbf564df23f109ab2a8bc34f000f4cc216517dba9dfa24ada859 |
Close
Hashes for sloth_ci.ext.build_email_notifications-1.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc92c5ff8b95f7d43fcf03cbccb22b0dd1a5f892b7ebea429605a5de0f07c3c6 |
|
MD5 | cdfa83b54d398223b4cc961d5fd5a054 |
|
BLAKE2b-256 | 9c1b9e5b10c115ae56c338b5db61359b41ae89404b790dca1669951876595043 |
Close
Hashes for sloth-ci.ext.build_email_notifications-1.0.7.win-amd64.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17c9225d2415a17b2e84ef147e757b9040c7c8589f9ba488125b11c960b784d4 |
|
MD5 | 799aff6e3ad869fdbe40659b163da370 |
|
BLAKE2b-256 | 56e12a4f1e2bfa0c3e432c8318f2e3a96dc29a0ea5d4dedc1aed88c5155f6a03 |