Apache Airflow Atlassian Jira Provider

raw JSON →
3.3.3 verified Mon Apr 13 auth: no python

The `apache-airflow-providers-atlassian-jira` package is an Apache Airflow provider that enables seamless integration with Atlassian Jira. It offers operators, sensors, and hooks to interact with Jira for automating tasks like issue creation, updates, and monitoring. As a community-managed provider, it follows Apache Airflow's release cadence, typically releasing minor updates every 2-3 months. The current version is 3.3.3.

pip install apache-airflow-providers-atlassian-jira
error ModuleNotFoundError: No module named 'airflow.providers.atlassian.jira'
cause The 'apache-airflow-providers-atlassian-jira' package is not installed.
fix
Install the package using pip: 'pip install apache-airflow-providers-atlassian-jira'.
error ImportError: cannot import name 'JiraHook' from 'airflow.providers.atlassian.jira.hooks.jira'
cause The 'JiraHook' class has been moved or renamed in the 'apache-airflow-providers-atlassian-jira' package.
fix
Ensure you are using the correct import statement as per the latest documentation: 'from airflow.providers.atlassian.jira.hooks.jira import JiraHook'.
error AttributeError: module 'airflow.providers.atlassian.jira.hooks.jira' has no attribute 'JiraHook'
cause The 'JiraHook' class is not present in the specified module, possibly due to a version mismatch.
fix
Verify that you have the correct version of 'apache-airflow-providers-atlassian-jira' installed and refer to the official documentation for the correct import path.
error TypeError: __init__() got an unexpected keyword argument 'jira_method'
cause The 'JiraOperator' no longer accepts the 'jira_method' argument due to changes in the underlying SDK.
fix
Update your code to align with the latest 'JiraOperator' parameters as specified in the official documentation.
error ValueError: Invalid Jira connection ID provided.
cause The connection ID specified for Jira in Airflow does not exist or is misconfigured.
fix
Ensure that the Jira connection ID is correctly set up in Airflow's connections and matches the ID used in your DAG.
breaking The Jira provider migrated from the legacy `Atlassian Jira SDK` to the `atlassian-python-api` SDK in version 2.0.0. This significantly changed how interactions are structured. `JiraHook.get_conn` now returns an `atlassian.Jira` object instead of a `jira.Jira` object. `JiraOperator` now requires `jira_method` and `jira_method_args` arguments, aligning with the new SDK's method calls.
fix Review and update your `JiraOperator` and `JiraHook` usages to conform to the `atlassian-python-api` SDK's methods and parameter structure. Ensure `jira_method` and `jira_method_args` are correctly specified for operators.
breaking Minimum Airflow version compatibility has increased. Provider version 3.1.0 requires Airflow 2.10+, and provider version 3.3.0+ requires Airflow 2.11+.
fix Upgrade your Apache Airflow environment to at least version 2.11.0 to use the latest features and bug fixes of this provider. Check the `PROVIDERS.rst` in the Apache Airflow GitHub repository for the most current compatibility matrix.
deprecated The `apache-airflow-providers-jira` package (note: without `atlassian` in the name) is deprecated as of version 3.1.0 in favor of `apache-airflow-providers-atlassian-jira`.
fix Migrate to `apache-airflow-providers-atlassian-jira` by updating your `pip install` commands and import paths (e.g., `from airflow.providers.jira...` becomes `from airflow.providers.atlassian.jira...`).
gotcha Due to the SDK migration, the `validate` and `get_server_info` keys in the Jira connection's 'Extra' JSON field are no longer supported.
fix Remove `validate` and `get_server_info` keys from the 'Extra' field of your Jira Airflow connections. Rely on the connection's host, login, password, and optional settings like `verify_ssl`.

This example DAG demonstrates how to create a Jira issue using the `JiraOperator`. It requires a pre-configured Airflow connection to Jira, typically using API Token authentication. Replace `YOUR_PROJECT_KEY` with an actual Jira project key.

from __future__ import annotations

import os
from datetime import datetime

from airflow.models.dag import DAG
from airflow.providers.atlassian.jira.operators.jira import JiraOperator

# Ensure you have an Airflow Connection named 'jira_default' configured.
# For a Jira API Token connection, use:
# Conn Id: jira_default
# Conn Type: Jira
# Host: https://your-jira-instance.atlassian.net
# Login: your_email@example.com
# Password: your_api_token

JIRA_CONN_ID = os.environ.get('AIRFLOW_JIRA_CONN_ID', 'jira_default')
JIRA_PROJECT_KEY = os.environ.get('AIRFLOW_JIRA_PROJECT_KEY', 'YOUR_PROJECT_KEY')

with DAG(
    dag_id='jira_create_issue_example',
    start_date=datetime(2023, 1, 1),
    schedule=None,
    catchup=False,
    tags=['jira', 'example'],
) as dag:
    create_jira_issue = JiraOperator(
        task_id='create_jira_issue',
        jira_conn_id=JIRA_CONN_ID,
        jira_method='create_issue',
        jira_method_args={
            'fields': {
                'project': {'key': JIRA_PROJECT_KEY},
                'summary': 'Airflow Automated Issue: Task Completed',
                'description': 'This issue was created by an Airflow DAG to log a completed task.',
                'issuetype': {'name': 'Task'},
            }
        },
    )