Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail Job Notification Plugin #5943

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/plugins/optional/results/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ where these examples are included. ::
html
result_upload
resultsdb
mail
1 change: 1 addition & 0 deletions docs/source/plugins/optional/results/mail.rst
75 changes: 0 additions & 75 deletions examples/plugins/job-pre-post/mail/avocado_job_mail.py

This file was deleted.

19 changes: 0 additions & 19 deletions examples/plugins/job-pre-post/mail/setup.py

This file was deleted.

1 change: 1 addition & 0 deletions optional_plugins/mail/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include VERSION README.rst
1 change: 1 addition & 0 deletions optional_plugins/mail/README
160 changes: 160 additions & 0 deletions optional_plugins/mail/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
Mail results Plugin
===================

The Mail result plugin enables you to receive email notifications
for job start and completion events within the Avocado testing framework.

.. note:: Currently only supports Gmail.

Installation
------------

To install the Mail results plugin from pip, use:

.. code-block:: bash

$ pip install avocado-framework-plugin-result-mail

Configuration
-------------

To use the Mail Result plugin, you need to configure it
in the Avocado settings file.

(`avocado.conf` located /etc/avocado/ if not present you can create the file)
Below is an configuration example:

.. note:: More information on configuration here.
For detailed configuration instructions,
please visit `Avocado Configuration <https://red.ht/avocadoconfig>`_.


.. code-block:: ini

[plugins.mail]

# The email address to which job notification emails will be sent.
recipient = avocado@local.com

# The subject header for the job notification emails.
header = [AVOCADO JOB NOTIFICATION]

# The email address from which the job notification emails will be sent.
sender = avocado@local.com

# The SMTP server address for sending the emails.
server = smtp.gmail.com

# The SMTP server port for sending the emails.
port = 587

# The application-specific password for the sender email address.
password = abcd efgh ijkl mnop

# The detail level of the email content.
# Set to false for a summary with essential details
# or true for detailed information about each failed test.
verbose = false

Usage
-----

Once configured, the Mail result plugin will automatically
send email notifications for job start and completion events
based on the specified settings.

Obtaining an App Password for Gmail
-----------------------------------

Please follow these steps to generate an App Password:

Create & use app passwords

Important: To create an app password,
you need 2-Step Verification on your Google Account.

#. Go to your Google Account.
#. Select Security.
#. Under "How you sign in to Google," select 2-Step Verification.
#. At the bottom of the page, select App passwords.
#. Enter a name that helps you remember where you’ll use the app password.
#. Select Generate.
#. To enter the app password, follow the instructions on your screen.
#. The app password is the 16-character code that generates on your device.
#. Select Done.

Enter the App Password inside of the avocado configuration file.

Remember to keep this App Password secure and don't share it with anyone.
If you suspect it has been compromised,
you can always revoke it and generate a new one.
harvey0100 marked this conversation as resolved.
Show resolved Hide resolved

Example Plugin Outputs
----------------------

.. code-block:: none

Verbose True

Job Notification - Job abca44fb69558024b0af74a5654ab282f00f1253
===============================================================

Job Total Time: 24.03 Seconds
Job Finished At: 2024-06-25 16:31:58

Results
-------

- PASS: 6
- ERROR: 0
- FAIL: 1
- SKIP: 0
- WARN: 0
- INTERRUPT: 0
- CANCEL: 0

Test Summary
------------

Name: selftests/safeloader.sh
Status: FAIL
Fail Reason:
Actual Time Start: 1719325898.06546
Actual Time End: 1719325902.474006
ID: static-checks-4-selftests/safeloader.sh
Log Directory: /home/hlynden/avocado/job-results/job-2024-06-25T16.31-abca44f/test-results/static-checks-4-selftests_safeloader.sh
Log File: /home/hlynden/avocado/job-results/job-2024-06-25T16.31-abca44f/test-results/static-checks-4-selftests_safeloader.sh/debug.log
Time Elapsed: 4.410571283999161 seconds
Time Start: 22630.607959844
Time End: 22635.018531128
Tags: {}
Whiteboard:



.. code-block:: none

Verbose False

Job Notification - Job 83da84014a9cbe7a89bea398eb1608dc04743897
===============================================================

Job Total Time: 24.03 Seconds
Job Finished At: 2024-06-25 16:31:58

Results
-------

- PASS: 6
- ERROR: 0
- FAIL: 1
- SKIP: 0
- WARN: 0
- INTERRUPT: 0
- CANCEL: 0

Test Summary
------------

Name: selftests/safeloader.sh
Fail Reason:
1 change: 1 addition & 0 deletions optional_plugins/mail/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
106.0
Empty file.
Loading
Loading