The Automatic Jira Report Generation Tool is a comprehensive Python script designed to automate the process of fetching Jira issues and compiling them into an organised report that's then sent via email. This tool simplifies the monitoring and management of Jira tickets by automatically generating and distributing reports, making it an invaluable resource for teams and individuals managing projects within Jira.
The tool is packed with features aimed at enhancing efficiency, security, and usability. Here's what it offers:
--assignee
: Use to specify the report's focus on a particular Jira user's tickets.--cc
: Add one or more email addresses to receive a carbon copy of the report, facilitating broader communication.
Centralises crucial settings, including Jira API credentials, SMTP email settings, and more, in a single, easily editable file.
Keeps sensitive information such as API tokens and email passwords within a secure configuration file, away from the main script code.
Generates email subjects dynamically, incorporating meaningful details like the assignee's name and current date. Supports HTML email formatting, including priority-based coloring for better readability and engagement.
Issues in the report are sorted based on priority, ensuring that the most critical items are highlighted and addressed first.
The script adapts the email's font and style based on the operating system, ensuring consistency across different email clients.
Detailed logging to /var/log/jira-report.log
helps track the script's operation and troubleshoot issues.
Robust error handling prevents execution continuation in the case of critical failures, enhancing script reliability.
Converts Jira ticket numbers in the report into direct links, enabling quick access to ticket details within Jira.
This tool requires Python 3 and several dependencies, including requests
for API interactions and smtplib
for sending emails. Configuration is handled through the config.ini
file, where users specify their Jira instance, credentials, email settings, and preferences for report formatting.
To run the script, use the following command format, replacing [assignee_username]
with the desired Jira user's username:
python jira-automatic-reports.py --assignee [assignee_username]
The config.ini
file serves as the backbone for configuring the Automatic Jira Report Generation Tool, allowing users to set up their Jira instance, email settings, and more. Below is a breakdown of each section within the config.ini
file:
-[jira]
: Defines the Jira server details and credentials for API access.
server
: The base URL of your Jira instance. Example:https://jira.satan.com
jira_ticket_base_url
: The base URL for accessing individual Jira tickets. Example:https://jira.satan.com/browse/
username
: Your Jira username.password
: Your Jira password or API token.
[email]
: Sets up the email sending details.sender
: The email address from which the reports will be sent. Example:[email protected]
recipient
: The default recipient email address for the reports. Example:[email protected]
smtp_server
: The SMTP server used for sending emails. Example:mail.blah.com
smtp_port
: The port used by the SMTP server. Commonly 465 for SSL. Example:465
smtp_username
: The username for authenticating with the SMTP server.smtp_password
: The password for authenticating with the SMTP server.
[assignee_recipients]
: Maps specific Jira assignees to email addresses, allowing for personalised report distribution.- Each entry under this section follows the format
jira_username = email_address
. This allows reports for specific Jira users (assignees) to be sent to designated email addresses. For example:
dean = [email protected]
karl = [email protected]
...