Work with Jira Issues
The Jira processor enables querying Jira issues using JQL (Jira Query Language) and returning structured data. It’s a processor, so you can use it in pipelines for input-style flows (pair with generate) or output-style flows (pair with drop).
Use this cookbook to:
-
Query Jira issues on a schedule or on-demand
-
Filter issues using JQL patterns
-
Create Jira issues using the HTTP processor
Prerequisites
The examples in this cookbook use the Secrets Store for Jira credentials. This keeps sensitive credentials secure and separate from your pipeline configuration.
-
Add your Jira credentials to the Secrets Store:
-
JIRA_BASE_URL: Your Jira instance URL (for example,https://your-domain.atlassian.net) -
JIRA_USERNAME: Your Jira account email address -
JIRA_API_TOKEN: The API token generated from your Atlassian account -
JIRA_AUTH_TOKEN(optional, for creating issues): Base64-encodedusername:api_tokenstring
-
Use Jira as an input
To use Jira as an input, combine the generate input with the Jira processor. This pattern triggers Jira queries at regular intervals or on-demand.
Replace MYPROJECT in the examples with your actual Jira project key.
|
Query Jira periodically
This example queries Jira every 30 seconds for recent issues:
input:
generate:
interval: 30s
mapping: |
root.jql = "project = MYPROJECT AND updated >= -1h ORDER BY updated DESC"
root.maxResults = 50
root.fields = ["key", "summary", "status", "assignee", "priority"]
pipeline:
processors:
- jira:
base_url: "${secrets.JIRA_BASE_URL}"
username: "${secrets.JIRA_USERNAME}"
api_token: "${secrets.JIRA_API_TOKEN}"
output:
stdout: {}
One-time query
For a single query, use count instead of interval:
input:
generate:
count: 1
mapping: |
root.jql = "project = MYPROJECT AND status = Open"
root.maxResults = 100
pipeline:
processors:
- jira:
base_url: "${secrets.JIRA_BASE_URL}"
username: "${secrets.JIRA_USERNAME}"
api_token: "${secrets.JIRA_API_TOKEN}"
output:
stdout: {}
Input message format
The Jira processor expects input messages containing valid Jira queries in JSON format:
{
"jql": "project = MYPROJECT AND status = Open",
"maxResults": 50,
"fields": ["key", "summary", "status", "assignee"]
}
Output message format
The Jira processor returns individual issue messages, rather than a response object with an issues array.
Each message output by the Jira processor represents a single issue:
{
"id": "12345",
"key": "DOC-123",
"fields": {
"summary": "Example issue",
"status": {
"name": "In Progress"
},
"assignee": {
"displayName": "John Doe"
}
}
}
Pagination handling
The Jira processor automatically handles pagination internally. The processor:
-
Makes the initial request with
startAt=0. -
Checks if more results are available.
-
Automatically fetches subsequent pages until all results are retrieved.
-
Outputs each issue as an individual message.
You don’t need to handle pagination manually.
Create and update Jira issues
The Jira processor is read-only and only supports querying. To create or update Jira issues, use the http processor with the Jira REST API.
Create a Jira issue
input:
generate:
count: 1
mapping: |
root.fields = {
"project": {"key": "MYPROJECT"},
"summary": "Issue created from Redpanda Connect",
"description": {
"type": "doc",
"version": 1,
"content": [{"type": "paragraph", "content": [{"type": "text", "text": "Created via API"}]}]
},
"issuetype": {"name": "Task"}
}
pipeline:
processors:
- http:
url: "${secrets.JIRA_BASE_URL}/rest/api/3/issue"
verb: POST
headers:
Content-Type: application/json
Authorization: "Basic ${secrets.JIRA_AUTH_TOKEN}"
output:
stdout: {}