Jira
Port's Jira integration allows you to model Jira resources in your software catalog and ingest data into them.
This integration supports Jira Cloud
at the moment. To integrate Port with Jira Server
, use Port's webhook integration.
Overview
This integration allows you to:
- Watch for Jira object changes (create/update/delete) in real-time, and automatically apply the changes to your software catalog.
- Define self-service actions that can create/delete Jira objects or perform any other logic on Jira resources.
Supported Resources
The resources that can be ingested from Jira into Port are listed below.
It is possible to reference any field that appears in the API responses linked below in the mapping configuration.
Setup
Choose one of the following installation methods:
- Hosted by Port
- Real-time (self-hosted)
- Scheduled (CI)
Using this installation option means that the integration will be hosted by Port, with a customizable resync interval to ingest data into Port.
Live event support
Currently, live events are not supported for integrations hosted by Port.
Resyncs will be performed periodically (with a configurable interval), or manually triggered by you via Port's UI.
Therefore, real-time events (including GitOps) will not be ingested into Port immediately.
Support for live events is WIP and will be supported in the near future.
Alternatively, you can install the integration using the Real-time (self-hosted) method to update Port in real time using webhooks.
Installation
To install, follow these steps:
-
Go to the Data sources page of your portal.
-
Click on the
+ Data source
button in the top-right corner. -
Click on the relevant integration in the list.
-
Under
Select your installation method
, chooseHosted by Port
. -
Configure the
integration settings
andapplication settings
as you wish (see below for details).
Application settings
Every integration hosted by Port has the following customizable application settings, which are configurable after installation:
-
Resync interval
: The frequency at which Port will ingest data from the integration. There are various options available, ranging from every 1 hour to once a day. -
Send raw data examples
: A boolean toggle (enabled
by default). If enabled, raw data examples will be sent from the integration to Port. These examples are used when testing your mapping configuration, they allow you to run yourjq
expressions against real data and see the results.
Integration settings
Every integration has its own tool-specific settings, under the Integration settings
section.
Each of these settings has an ⓘ icon next to it, which you can hover over to see a description of the setting.
Port secrets
Some integration settings require sensitive pieces of data, such as tokens.
For these settings, Port secrets will be used, ensuring that your sensitive data is encrypted and secure.
When filling in such a setting, its value will be obscured (shown as ••••••••
).
For each such setting, Port will automatically create a secret in your organization.
To see all secrets in your organization, follow these steps.
Port source IP addresses
When using this installation method, Port will make outbound calls to your 3rd-party applications from static IP addresses.
You may need to add these addresses to your allowlist, in order to allow Port to interact with the integrated service:
- Europe (EU)
- United States (US)
54.73.167.226
63.33.143.237
54.76.185.219
3.234.37.33
54.225.172.136
3.225.234.99
Using this installation option means that the integration will be able to update Port in real time using webhooks.
Prerequisites
To install the integration, you need a Kubernetes cluster that the integration's container chart will be deployed to.
Please make sure that you have kubectl
and helm
installed on your machine, and that your kubectl
CLI is connected to the Kubernetes cluster where you plan to install the integration.
If you are having trouble installing this integration, please refer to these troubleshooting steps.
For details about the available parameters for the installation, see the table below.
- Helm
- ArgoCD
To install the integration using Helm:
-
Go to the Jira data source page in your portal.
-
Select the
Real-time and always on
method: -
A
helm
command will be displayed, with default values already filled out (e.g. your Port cliend ID, client secret, etc).
Copy the command, replace the placeholders with your values, then run it in your terminal to install the integration.
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
To install the integration using ArgoCD:
- Create a
values.yaml
file inargocd/my-ocean-jira-integration
in your git repository with the content:
Remember to replace the placeholders for ATLASSIAN_JIRA_HOST
ATLASSIAN_USER_EMAIL
and ATLASSIAN_USER_TOKEN
.
initializePortResources: true
scheduledResyncInterval: 120
integration:
identifier: my-ocean-jira-integration
type: jira
eventListener:
type: POLLING
config:
jiraHost: ATLASSIAN_JIRA_HOST
secrets:
atlassianUserEmail: ATLASSIAN_USER_EMAIL
atlassianUserToken: ATLASSIAN_USER_TOKEN
- Install the
my-ocean-jira-integration
ArgoCD Application by creating the followingmy-ocean-jira-integration.yaml
manifest:
Remember to replace the placeholders for YOUR_PORT_CLIENT_ID
YOUR_PORT_CLIENT_SECRET
and YOUR_GIT_REPO_URL
.
Multiple sources ArgoCD documentation can be found here.
ArgoCD Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-ocean-jira-integration
namespace: argocd
spec:
destination:
namespace: mmy-ocean-jira-integration
server: https://kubernetes.default.svc
project: default
sources:
- repoURL: 'https://port-labs.github.io/helm-charts/'
chart: port-ocean
targetRevision: 0.1.14
helm:
valueFiles:
- $values/argocd/my-ocean-jira-integration/values.yaml
parameters:
- name: port.clientId
value: YOUR_PORT_CLIENT_ID
- name: port.clientSecret
value: YOUR_PORT_CLIENT_SECRET
- name: port.baseUrl
value: https://api.getport.io
- repoURL: YOUR_GIT_REPO_URL
targetRevision: main
ref: values
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
- Apply your application manifest with
kubectl
:
kubectl apply -f my-ocean-jira-integration.yaml
This table summarizes the available parameters for the installation.
Parameter | Description | Example | Required |
---|---|---|---|
port.clientId | Your port client id | ✅ | |
port.clientSecret | Your port client secret | ✅ | |
port.baseUrl | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ | |
integration.secrets.atlassianUserEmail | The email of the user used to query Jira | user@example.com | ✅ |
integration.secrets.atlassianUserToken | Jira API token generated by the user | ✅ | |
integration.config.jiraHost | The URL of your Jira | https://example.atlassian.net | ✅ |
integration.config.appHost | The host of the Port Ocean app. Used to set up the integration endpoint as the target for webhooks created in Jira | https://my-ocean-integration.com | ✅ |
integration.eventListener.type | The event listener type. Read more about event listeners | ✅ | |
integration.type | The integration to be installed | ✅ | |
scheduledResyncInterval | The number of minutes between each resync. When not set the integration will resync for each event listener resync event. Read more about scheduledResyncInterval | ❌ | |
initializePortResources | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources | ❌ | |
sendRawDataExamples | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
For advanced configuration such as proxies or self-signed certificates, click here.
This workflow/pipeline will run the Jira integration once and then exit, this is useful for scheduled ingestion of data.
If you want the integration to update Port in real time using webhooks you should use the Real-time (self-hosted) installation option.
- GitHub
- Jenkins
- Azure Devops
- GitLab
Make sure to configure the following Github Secrets:
Parameter | Description | Example | Required |
---|---|---|---|
port_client_id | Your Port client (How to get the credentials) id | ✅ | |
port_client_secret | Your Port client (How to get the credentials) secret | ✅ | |
port_base_url | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ | |
config -> jira_host | The URL of your Jira | https://example.atlassian.net | ✅ |
config -> atlassian_user_email | The email of the user used to query Jira | user@example.com | ✅ |
config -> atlassian_user_token | Jira API token generated by the user | ✅ | |
initialize_port_resources | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources | ❌ | |
send_raw_data_examples | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ | |
identifier | The identifier of the integration that will be installed | ❌ | |
version | The version of the integration that will be installed | latest | ❌ |
The following example uses the Ocean Sail Github Action to run the Jira integration. For further information about the action, please visit the Ocean Sail Github Action
Here is an example for jira-integration.yml
workflow file:
name: Jira Exporter Workflow
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *' # Determines the scheduled interval for this workflow. This example runs every hour.
jobs:
run-integration:
runs-on: ubuntu-latest
timeout-minutes: 30 # Set a time limit for the job
steps:
- uses: port-labs/ocean-sail@v1
with:
type: 'jira'
port_client_id: ${{ secrets.OCEAN__PORT__CLIENT_ID }}
port_client_secret: ${{ secrets.OCEAN__PORT__CLIENT_SECRET }}
port_base_url: https://api.getport.io
config: |
jira_host: ${{ secrets.OCEAN__INTEGRATION__CONFIG__JIRA_HOST }}
atlassian_user_email: ${{ secrets.OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL }}
atlassian_user_token: ${{ secrets.OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN }}
Your Jenkins agent should be able to run docker commands.
Make sure to configure the following Jenkins Credentials of Secret Text
type:
Parameter | Description | Example | Required |
---|---|---|---|
OCEAN__INTEGRATION__CONFIG__JIRA_HOST | The URL of your Jira | https://example.atlassian.net | ✅ |
OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL | The email of the user used to query Jira | user@example.com | ✅ |
OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN | Jira API token generated by the user | ✅ | |
OCEAN__PORT__CLIENT_ID | Your Port client (How to get the credentials) id | ✅ | |
OCEAN__PORT__CLIENT_SECRET | Your Port client (How to get the credentials) secret | ✅ | |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ | |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources | ❌ | |
OCEAN__INTEGRATION__IDENTIFIER | The identifier of the integration that will be installed | ❌ | |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
Here is an example for Jenkinsfile
groovy pipeline file:
pipeline {
agent any
stages {
stage('Run Jira Integration') {
steps {
script {
withCredentials([
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__JIRA_HOST', variable: 'OCEAN__INTEGRATION__CONFIG__JIRA_HOST'),
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL', variable: 'OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL'),
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN', variable: 'OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN'),
string(credentialsId: 'OCEAN__PORT__CLIENT_ID', variable: 'OCEAN__PORT__CLIENT_ID'),
string(credentialsId: 'OCEAN__PORT__CLIENT_SECRET', variable: 'OCEAN__PORT__CLIENT_SECRET'),
]) {
sh('''
#Set Docker image and run the container
integration_type="jira"
version="latest"
image_name="ghcr.io/port-labs/port-ocean-${integration_type}:${version}"
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__JIRA_HOST=$OCEAN__INTEGRATION__CONFIG__JIRA_HOST \
-e OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL=$OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL \
-e OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN=$OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN \
-e OCEAN__PORT__CLIENT_ID=$OCEAN__PORT__CLIENT_ID \
-e OCEAN__PORT__CLIENT_SECRET=$OCEAN__PORT__CLIENT_SECRET \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$image_name
exit $?
''')
}
}
}
}
}
}
Your Azure Devops agent should be able to run docker commands. Learn more about agents here.
Variable groups store values and secrets you'll use in your pipelines across your project. Learn more
Setting Up Your Credentials
- Create a Variable Group: Name it port-ocean-credentials.
- Store the required variables (see the table below).
- Authorize Your Pipeline:
- Go to "Library" -> "Variable groups."
- Find port-ocean-credentials and click on it.
- Select "Pipeline Permissions" and add your pipeline to the authorized list.
Parameter | Description | Example | Required |
---|---|---|---|
OCEAN__INTEGRATION__CONFIG__JIRA_HOST | The URL of your Jira | https://example.atlassian.net | ✅ |
OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL | The email of the user used to query Jira | user@example.com | ✅ |
OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN | Jira API token generated by the user | ✅ | |
OCEAN__PORT__CLIENT_ID | Your Port client (How to get the credentials) id | ✅ | |
OCEAN__PORT__CLIENT_SECRET | Your Port client (How to get the credentials) secret | ✅ | |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ | |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources | ❌ | |
OCEAN__INTEGRATION__IDENTIFIER | The identifier of the integration that will be installed | ❌ | |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
Here is an example for jira-integration.yml
pipeline file:
trigger:
- main
pool:
vmImage: "ubuntu-latest"
variables:
- group: port-ocean-credentials
steps:
- script: |
# Set Docker image and run the container
integration_type="jira"
version="latest"
image_name="ghcr.io/port-labs/port-ocean-$integration_type:$version"
docker run -i --rm \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__JIRA_HOST=$(OCEAN__INTEGRATION__CONFIG__JIRA_HOST) \
-e OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL=$(OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL) \
-e OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN=$(OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN) \
-e OCEAN__PORT__CLIENT_ID=$(OCEAN__PORT__CLIENT_ID) \
-e OCEAN__PORT__CLIENT_SECRET=$(OCEAN__PORT__CLIENT_SECRET) \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$image_name
exit $?
displayName: "Ingest Data into Port"
Make sure to configure the following GitLab variables:
Parameter | Description | Example | Required |
---|---|---|---|
OCEAN__INTEGRATION__CONFIG__JIRA_HOST | The URL of your Jira | https://example.atlassian.net | ✅ |
OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL | The email of the user used to query Jira | user@example.com | ✅ |
OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN | Jira API token generated by the user | ✅ | |
OCEAN__PORT__CLIENT_ID | Your Port client (How to get the credentials) id | ✅ | |
OCEAN__PORT__CLIENT_SECRET | Your Port client (How to get the credentials) secret | ✅ | |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ | |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources | ❌ | |
OCEAN__INTEGRATION__IDENTIFIER | The identifier of the integration that will be installed | ❌ | |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
Here is an example for .gitlab-ci.yml
pipeline file:
default:
image: docker:24.0.5
services:
- docker:24.0.5-dind
before_script:
- docker info
variables:
INTEGRATION_TYPE: jira
VERSION: latest
stages:
- ingest
ingest_data:
stage: ingest
variables:
IMAGE_NAME: ghcr.io/port-labs/port-ocean-$INTEGRATION_TYPE:$VERSION
script:
- |
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__JIRA_HOST=$OCEAN__INTEGRATION__CONFIG__JIRA_HOST \
-e OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL=$OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL \
-e OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN=$OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN \
-e OCEAN__PORT__CLIENT_ID=$OCEAN__PORT__CLIENT_ID \
-e OCEAN__PORT__CLIENT_SECRET=$OCEAN__PORT__CLIENT_SECRET \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$IMAGE_NAME
rules: # Run only when changes are made to the main branch
- if: '$CI_COMMIT_BRANCH == "main"'
- when: manual
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
For advanced configuration such as proxies or self-signed certificates, click here.
Configuration
Port integrations use a YAML mapping block to ingest data from the third-party api into Port.
The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.
JQL support
The Ocean Jira integration supports querying objects from the issue
kind using JQL, making it possible to specifically filter the issues that are queried from Jira and ingested to Port.
To use JQL filtering, add to the selector
object a jql
key with your desired JQL query as the value. For example:
resources:
- kind: issue # JQL filtering can only be used with the "issue" kind
selector:
query: "true" # JQ boolean expression. If evaluated to false - this object will be skipped.
jql: "status != Done" # JQL query, will only ingest issues whose status is not "Done"
port:
Limitations
Getting user emails from Jira
By default, Jira does not attach user emails to its API responses. For example, when making an API request to Jira to get an issue, fields such as assignee
, creator
, reporter
and other user fields, will only include information such as the internal user ID and user display name, but not the user email.
In order to display the user email in API responses (and also use that data in the mapping from Jira to Port), follow these steps:
Verify your domain in Jira:
- Go to the Jira admin panel.
- Go to the Settings tab.
- Select Domains in the sidebar on the left.
- If your domain (for example -
acme.com
) does not appear in the list, click on Add domain. - Enter your domain name and click on Next.
- Verify your domain ownership in whichever way is convenient for you.
When you are done, you will see in the domain menu that your domain is listed, and its status is VERIFIED
under the Domain status column.
Claim your Jira user accounts:
- Go to the Jira admin panel.
- Go to the Settings tab.
- Select Domains in the sidebar on the left.
- Find your verified domain in the list whose accounts need to be claimed.
- Click the 3 horizontal dots (
...
) under the Actions column. - Select Claim accounts.
- You will receive an email from Jira when the claim process is complete.
That's it! Now Jira API responses will include the emailAddress
field when returning a user from Jira.
All of the steps outlined here are also available in Jira's documentation
Examples
To view and test the integration's mapping against examples of the third-party API responses, use the jq playground in your data sources page. Find the integration in the list of data sources and click on it to open the playground.
Examples of blueprints and the relevant integration configurations:
Project
Project blueprint
{
"identifier": "jiraProject",
"title": "Jira Project",
"icon": "Jira",
"description": "A Jira project",
"schema": {
"properties": {
"url": {
"title": "Project URL",
"type": "string",
"format": "url",
"description": "URL to the project in Jira"
},
"totalIssues": {
"title": "Total Issues",
"type": "number",
"description": "The total number of issues in the project"
}
}
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: project
selector:
query: "true"
port:
entity:
mappings:
identifier: .key
title: .name
blueprint: '"jiraProject"'
properties:
url: (.self | split("/") | .[:3] | join("/")) + "/projects/" + .key
totalIssues: .insight.totalIssueCount
User
User blueprint
{
"identifier": "jiraUser",
"title": "Jira User",
"icon": "User",
"description": "A Jira user account",
"schema": {
"properties": {
"emailAddress": {
"title": "Email",
"type": "string",
"format": "email",
"description": "User's email address"
},
"displayName": {
"title": "Display Name",
"type": "string",
"description": "User's full name as displayed in Jira"
},
"active": {
"title": "Active Status",
"type": "boolean",
"description": "Whether the user account is active"
},
"accountType": {
"title": "Account Type",
"type": "string",
"description": "Type of Jira account (e.g., atlassian, customer)"
}
}
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Integration configuration
- kind: user
selector:
query: "true"
port:
entity:
mappings:
identifier: .accountId
title: .displayName
blueprint: '"jiraUser"'
properties:
emailAddress: .emailAddress
displayName: .displayName
active: .active
accountType: .accountType
Issue
Issue blueprint
{
"identifier": "jiraIssue",
"title": "Jira Issue",
"icon": "Jira",
"schema": {
"properties": {
"url": {
"title": "Issue URL",
"type": "string",
"format": "url",
"description": "URL to the issue in Jira"
},
"status": {
"title": "Status",
"type": "string",
"description": "The status of the issue"
},
"issueType": {
"title": "Type",
"type": "string",
"description": "The type of the issue"
},
"components": {
"title": "Components",
"type": "array",
"description": "The components related to this issue"
},
"creator": {
"title": "Creator",
"type": "string",
"description": "The user that created to the issue",
"format": "user"
},
"priority": {
"title": "Priority",
"type": "string",
"description": "The priority of the issue"
},
"labels": {
"items": {
"type": "string"
},
"title": "Labels",
"type": "array"
},
"created": {
"title": "Created At",
"type": "string",
"description": "The created datetime of the issue",
"format": "date-time"
},
"updated": {
"title": "Updated At",
"type": "string",
"description": "The updated datetime of the issue",
"format": "date-time"
},
"resolutionDate": {
"title": "Resolved At",
"type": "string",
"description": "The datetime the issue changed to a resolved state",
"format": "date-time"
}
}
},
"calculationProperties": {
"handlingDuration": {
"title": "Handling Duration (Days)",
"icon": "Clock",
"description": "The amount of time in days from issue creation to issue resolution",
"calculation": "if (.properties.resolutionDate != null and .properties.created != null) then ((.properties.resolutionDate[0:19] + \"Z\" | fromdateiso8601) - (.properties.created[0:19] + \"Z\" | fromdateiso8601)) / 86400 else null end",
"type": "number"
}
},
"mirrorProperties": {},
"aggregationProperties": {},
"relations": {
"project": {
"target": "jiraProject",
"title": "Project",
"description": "The Jira project that contains this issue",
"required": false,
"many": false
},
"parentIssue": {
"target": "jiraIssue",
"title": "Parent Issue",
"required": false,
"many": false
},
"subtasks": {
"target": "jiraIssue",
"title": "Subtasks",
"required": false,
"many": true
},
"assignee": {
"target": "jiraUser",
"title": "Assignee",
"required": false,
"many": false
},
"reporter": {
"target": "jiraUser",
"title": "Reporter",
"required": false,
"many": false
}
}
}
Integration configuration
- kind: issue
selector:
query: "true"
jql: "(statusCategory != Done) OR (created >= -1w) OR (updated >= -1w)"
port:
entity:
mappings:
identifier: .key
title: .fields.summary
blueprint: '"jiraIssue"'
properties:
url: (.self | split("/") | .[:3] | join("/")) + "/browse/" + .key
status: .fields.status.name
issueType: .fields.issuetype.name
components: .fields.components
creator: .fields.creator.emailAddress
priority: .fields.priority.id
labels: .fields.labels
created: .fields.created
updated: .fields.updated
resolutionDate: .fields.resolutiondate
relations:
project: .fields.project.key
parentIssue: .fields.parent.key
subtasks: .fields.subtasks | map(.key)
assignee: .fields.assignee.accountId
reporter: .fields.reporter.accountId
Let's Test It
This section includes a sample response data from Jira. In addition, it includes the entity created from the resync event based on the Ocean configuration provided in the previous section.
Payload
Here is an example of the payload structure from Jira:
Project response data
{
"expand": "description,lead,issueTypes,url,projectKeys,permissions,insight",
"self": "https://myaccount.atlassian.net/rest/api/3/project/10000",
"id": "10000",
"key": "PA",
"name": "Port-AI",
"avatarUrls": {
"48x48": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413",
"24x24": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413?size=small",
"16x16": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413?size=xsmall",
"32x32": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413?size=medium"
},
"projectTypeKey": "software",
"simplified": true,
"style": "next-gen",
"isPrivate": false,
"properties": {},
"entityId": "7f4f8d6f-705b-4074-84be-46f0d012cd8e",
"uuid": "7f4f8d6f-705b-4074-84be-46f0d012cd8e"
}
User response data
{
"accountId": "U-PA",
"accountType": "app",
"active": true,
"avatarUrls": {
"16x16": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png",
"24x24": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png",
"32x32": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png",
"48x48": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png"
},
"displayName": "AI",
"key": "",
"name": "",
"self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=U-PA"
},
{
"accountId": "U-PA-2",
"accountType": "app",
"active": true,
"avatarUrls": {
"16x16": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png",
"24x24": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png",
"32x32": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png",
"48x48": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png"
},
"displayName": "AI-2",
"key": "",
"name": "",
"self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=U-PA-2"
}
Issue response data
{
"expand": "operations,versionedRepresentations,editmeta,changelog,customfield_10010.requestTypePractice,renderedFields",
"id": "10000",
"self": "https://myaccount.atlassian.net/rest/api/3/issue/10000",
"key": "PA-1",
"fields": {
"statuscategorychangedate": "2023-11-06T11:02:59.341+0000",
"issuetype": {
"self": "https://myaccount.atlassian.net/rest/api/3/issuetype/10001",
"id": "10001",
"description": "Tasks track small, distinct pieces of work.",
"iconUrl": "https://myaccount.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium",
"name": "Task",
"subtask": false,
"avatarId": 10318,
"entityId": "a7309bf9-70c5-4237-bdaf-0261037b6ecc",
"hierarchyLevel": 0
},
"timespent": "None",
"customfield_10030": "None",
"project": {
"self": "https://myaccount.atlassian.net/rest/api/3/project/10000",
"id": "10000",
"key": "PA",
"name": "Port-AI",
"projectTypeKey": "software",
"simplified": true,
"avatarUrls": {
"48x48": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413",
"24x24": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413?size=small",
"16x16": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413?size=xsmall",
"32x32": "https://myaccount.atlassian.net/rest/api/3/universal_avatar/view/type/project/avatar/10413?size=medium"
}
},
"customfield_10031": "None",
"customfield_10032": "None",
"fixVersions": [],
"aggregatetimespent": "None",
"resolution": "None",
"customfield_10027": "None",
"customfield_10028": "None",
"customfield_10029": "None",
"resolutiondate": "None",
"workratio": -1,
"watches": {
"self": "https://myaccount.atlassian.net/rest/api/3/issue/PA-1/watchers",
"watchCount": 1,
"isWatching": true
},
"lastViewed": "None",
"created": "2023-11-06T11:02:59.000+0000",
"customfield_10020": "None",
"customfield_10021": "None",
"customfield_10022": "None",
"priority": {
"self": "https://myaccount.atlassian.net/rest/api/3/priority/3",
"iconUrl": "https://myaccount.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
},
"customfield_10023": "None",
"customfield_10024": "None",
"customfield_10025": "None",
"labels": ["infra"],
"customfield_10026": "None",
"customfield_10016": "None",
"customfield_10017": "None",
"customfield_10018": {
"hasEpicLinkFieldDependency": false,
"showField": false,
"nonEditableReason": {
"reason": "PLUGIN_LICENSE_ERROR",
"message": "The Parent Link is only available to Jira Premium users."
}
},
"customfield_10019": "0|hzzzzz:",
"timeestimate": "None",
"aggregatetimeoriginalestimate": "None",
"versions": [],
"issuelinks": [],
"assignee": {
"self": "https://myaccount.atlassian.net/rest/api/3/user?accountId=712020%3A05acda87-42da-44d8-b21e-f71a508e5d11",
"accountId": "712020:05acda87-42da-44d8-b21e-f71a508e5d11",
"emailAddress": "username@example.com.io",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"24x24": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"16x16": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"32x32": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png"
},
"displayName": "User Name",
"active": true,
"timeZone": "UTC",
"accountType": "atlassian"
},
"updated": "2023-11-06T11:03:18.244+0000",
"status": {
"self": "https://myaccount.atlassian.net/rest/api/3/status/10000",
"description": "",
"iconUrl": "https://myaccount.atlassian.net/",
"name": "To Do",
"id": "10000",
"statusCategory": {
"self": "https://myaccount.atlassian.net/rest/api/3/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
}
},
"components": [],
"timeoriginalestimate": "None",
"description": "None",
"customfield_10010": "None",
"customfield_10014": "None",
"customfield_10015": "None",
"customfield_10005": "None",
"customfield_10006": "None",
"security": "None",
"customfield_10007": "None",
"customfield_10008": "None",
"aggregatetimeestimate": "None",
"customfield_10009": "None",
"summary": "Setup infra",
"creator": {
"self": "https://myaccount.atlassian.net/rest/api/3/user?accountId=712020%3A05acda87-42da-44d8-b21e-f71a508e5d11",
"accountId": "712020:05acda87-42da-44d8-b21e-f71a508e5d11",
"emailAddress": "username@example.com.io",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"24x24": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"16x16": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"32x32": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png"
},
"displayName": "User Name",
"active": true,
"timeZone": "UTC",
"accountType": "atlassian"
},
"subtasks": [],
"reporter": {
"self": "https://myaccount.atlassian.net/rest/api/3/user?accountId=712020%3A05acda87-42da-44d8-b21e-f71a508e5d11",
"accountId": "712020:05acda87-42da-44d8-b21e-f71a508e5d11",
"emailAddress": "username@example.com.io",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"24x24": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"16x16": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png",
"32x32": "https://secure.gravatar.com/avatar/0d5d34ceb820d324d69046a1b2f51dc0?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-3.png"
},
"displayName": "User Name",
"active": true,
"timeZone": "UTC",
"accountType": "atlassian"
},
"aggregateprogress": {
"progress": 0,
"total": 0
},
"customfield_10001": "None",
"customfield_10002": "None",
"customfield_10003": "None",
"customfield_10004": "None",
"environment": "None",
"duedate": "None",
"progress": {
"progress": 0,
"total": 0
},
"votes": {
"self": "https://myaccount.atlassian.net/rest/api/3/issue/PA-1/votes",
"votes": 0,
"hasVoted": false
}
}
}
Mapping Result
The combination of the sample payload and the Ocean configuration generates the following Port entity:
Project entity in Port
{
"identifier": "PA",
"title": "Port-AI",
"icon": null,
"blueprint": "jiraProject",
"team": [],
"properties": {
"url": "https://myaccount.atlassian.net/projects/PA",
"totalIssues": 100
},
"relations": {},
"createdAt": "2023-11-06T11:22:05.433Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2023-11-06T11:22:05.433Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
User entity in Port
{
"identifier": "U-PA",
"title": "AI",
"team": [],
"properties": {
"accountId": "U-PA",
"displayName": "AI",
"active": true,
"accountType": "app",
"avatarUrl": "https://secure.gravatar.com/avatar/ab3787cd0c16633ae050dff9d5ab15fc?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FS-0.png"
},
"relations": {},
"icon": "User"
}
Issue entity in Port
{
"identifier": "PA-1",
"title": "Setup infra",
"icon": null,
"blueprint": "jiraIssue",
"team": [],
"properties": {
"url": "https://myaccount.atlassian.net/browse/PA-1",
"status": "To Do",
"issueType": "Task",
"components": [],
"creator": "username@example.com.io",
"priority": "3",
"created": "2023-11-06T11:02:59.000+0000",
"updated": "2023-11-06T11:03:18.244+0000"
},
"relations": {
"parentIssue": null,
"project": "PA",
"assignee": "username@example.com.io",
"reporter": "username@example.com.io",
"subtasks": []
},
"createdAt": "2023-11-06T11:22:07.550Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2023-11-06T11:22:07.550Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Relevant Guides
For relevant guides and examples, see the guides section.
Alternative installation via webhook
While the Ocean integration described above is the recommended installation method, you may prefer to use a webhook to ingest data from Jira. If so, use the following instructions:
Note that when using this method, data will be ingested into Port only when the webhook is triggered.
Webhook installation (click to expand)
In this example you are going to create a webhook integration between Jira and Port, which will ingest Jira issue entities.
Port configuration
Create the following blueprint definition:
Jira issue blueprint
{
"identifier": "jiraIssue",
"description": "This blueprint represents issues from Jira",
"title": "Jira Issue",
"icon": "Jira",
"schema": {
"properties": {
"summary": {
"type": "string",
"title": "Summary"
},
"description": {
"type": "string",
"title": "Description"
},
"lastChangeType": {
"type": "string",
"title": "Last change type",
"description": "The type of the latest change made to this issue"
},
"changingUser": {
"type": "string",
"title": "Changing user",
"description": "The user that made the latest change"
},
"issueUrl": {
"type": "string",
"title": "Issue URL",
"format": "url",
"description": "URL to the issue"
},
"issueType": {
"type": "string",
"title": "Type",
"description": "The type of the issue"
},
"status": {
"type": "string",
"title": "Status",
"description": "The status of the issue"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
Create the following webhook configuration using Port's UI
Jira issue webhook configuration
-
Basic details tab - fill the following details:
- Title :
Jira mapper
; - Identifier :
jira_mapper
; - Description :
A webhook configuration to map Jira issues to Port
; - Icon :
Jira
;
- Title :
-
Integration configuration tab - fill the following JQ mapping:
[
{
"blueprint": "jiraIssue",
"entity": {
"identifier": ".body.issue.key",
"title": ".body.issue.key + \" - \" + .body.issue.fields.summary",
"properties": {
"summary": ".body.issue.fields.summary",
"description": ".body.issue.fields.description",
"status": ".body.issue.fields.status.name",
"lastChangeType": ".body.issue_event_type_name",
"changingUser": ".body.user.displayName",
"issueUrl": "(.body.issue.self | split(\"rest\") | first) + \"browse/\" + .body.issue.key",
"issueType": ".body.issue.fields.issuetype.name"
}
}
}
] -
Click Save at the bottom of the page.
Create a webhook in Jira
- Log in to Jira as a user with the Administer Jira global permission;
- Click the gear icon at the top right corner;
- Choose System;
- At the bottom of the sidebar on the left, under Advanced, choose WebHooks;
- Click on Create a WebHook
- Input the following details:
Name
- use a meaningful name such as Port Webhook;Status
- be sure to keep the webhook Enabled;Webhook URL
- enter the value of theurl
key you received after creating the webhook configuration;Description
- enter a description for the webhook;Issue related events
- enter a JQL query in this section to filter the issues that get sent to the webhook (if you leave this field empty, all issues will trigger a webhook event);- Under
Issue
- mark created, updated and delete;
- Click Create at the bottom of the page.
In order to view the different payloads and events available in Jira webhooks, look here
Done! any change you make to an issue (open, close, edit, etc.) will trigger a webhook event that Jira will send to the webhook URL provided by Port. Port will parse the events according to the mapping and update the catalog entities accordingly.
Let's Test It
This section includes a sample webhook event sent from Jira when an issue is created or updated. In addition, it includes the entity created from the event based on the webhook configuration provided in the previous section.
Payload
Here is an example of the payload structure sent to the webhook URL when a Jira issue is created:
Webhook event payload
{
"timestamp": 1686916266116,
"webhookEvent": "jira:issue_created",
"issue_event_type_name": "issue_created",
"user": {
"self": "https://account.atlassian.net/rest/api/2/user?accountId=557058%3A69f39959-769f-4dac-8a7a-46eb55b03723",
"accountId": "557058%3A69f39959-769f-4dac-8a7a-46eb55b03723",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/9df2ac1caa70b0a67ff0561f7d0363e5?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-1.png"
},
"displayName": "Your Name",
"active": true,
"timeZone": "Europe/London",
"accountType": "atlassian"
},
"issue": {
"id": "10000",
"self": "https://account.atlassian.net/rest/api/2/10000",
"key": "PI-1",
"fields": {
"statuscategorychangedate": "2023-06-16T11:51:06.277+0000",
"issuetype": {
"self": "https://account.atlassian.net/rest/api/2/issuetype/10002",
"id": "10002",
"description": "Epics track collections of related bugs, stories, and tasks.",
"iconUrl": "https://account.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium",
"name": "Epic",
"subtask": false,
"avatarId": 10307,
"entityId": "66c6d416-6eb4-4b38-92fa-9a7d68c64165",
"hierarchyLevel": 1
},
"timespent": "None",
"project": {
"self": "https://account.atlassian.net/rest/api/2/project/10000",
"id": "10000",
"key": "PI",
"name": "Port Integration",
"projectTypeKey": "software",
"simplified": true,
"avatarUrls": {
"48x48": "https://account.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10413"
}
},
"fixVersions": [],
"aggregatetimespent": "None",
"resolution": "None",
"resolutiondate": "None",
"workratio": -1,
"watches": {
"self": "https://account.atlassian.net/rest/api/2/issue/PI-1/watchers",
"watchCount": 0,
"isWatching": false
},
"issuerestriction": {
"issuerestrictions": {},
"shouldDisplay": true
},
"lastViewed": "None",
"created": "2023-06-16T11:51:05.291+0000",
"priority": {
"self": "https://account.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://account.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
},
"labels": ["cloud", "infra"],
"issuelinks": [],
"assignee": {
"self": "https://account.atlassian.net/rest/api/2/user?accountId=557058%3A69f39947-769f-4dac-8a7a-46eb55b03705",
"accountId": "557058:69f39947-769f-4dac-8a7a-46eb55b03705",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/9df2ac1caa70b0a67ff0561f7d0363e5?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-1.png"
},
"displayName": "Your Name",
"active": true,
"timeZone": "Europe/London",
"accountType": "atlassian"
},
"updated": "2023-06-16T11:51:05.291+0000",
"status": {
"self": "https://account.atlassian.net/rest/api/2/status/10000",
"description": "",
"iconUrl": "https://account.atlassian.net/",
"name": "To Do",
"id": "10000",
"statusCategory": {
"self": "https://account.atlassian.net/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "New"
}
},
"components": [],
"timeoriginalestimate": "None",
"description": "We need to migrate our current infrastructure from in-house to the cloud",
"attachment": [],
"summary": "Migrate Infra to Cloud",
"creator": {
"self": "https://account.atlassian.net/rest/api/2/user?accountId=557058%3A69f39947-769f-4dac-8a7a-46eb55b03705",
"accountId": "557058:69f39947-769f-4dac-8a7a-46eb55b03705",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/9df2ac1caa70b0a67ff0561f7d0363e5?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-1.png"
},
"displayName": "Your Name",
"active": true,
"timeZone": "Europe/London",
"accountType": "atlassian"
},
"subtasks": [],
"reporter": {
"self": "https://account.atlassian.net/rest/api/2/user?accountId=557058%3A69f39947-769f-4dac-8a7a-46eb55b03705",
"accountId": "557058:69f39947-769f-4dac-8a7a-46eb55b03705",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/9df2ac1caa70b0a67ff0561f7d0363e5?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIC-1.png"
},
"displayName": "Your Name",
"active": true,
"timeZone": "Europe/London",
"accountType": "atlassian"
},
"aggregateprogress": {
"progress": 0,
"total": 0
},
"environment": "None",
"duedate": "2023-06-19",
"progress": {
"progress": 0,
"total": 0
},
"votes": {
"self": "https://account.atlassian.net/rest/api/2/issue/PI-1/votes",
"votes": 0,
"hasVoted": false
}
}
},
"changelog": {
"id": "10001",
"items": [
{
"field": "status",
"fieldtype": "jira",
"fieldId": "status",
"from": "10000",
"fromString": "To Do",
"to": "10001",
"toString": "In Progress"
}
]
}
}
Mapping Result
The combination of the sample payload and the webhook configuration generates the following Port entity:
{
"identifier": "PI-1",
"title": "PI-1 - Migrate Infra to Cloud",
"blueprint": "jiraIssue",
"properties": {
"summary": "Migrate Infra to Cloud",
"description": "We need to migrate our current infrastructure from in-house to the cloud",
"status": "To Do",
"lastChangeType": "issue_created",
"changingUser": "Your Name",
"issueUrl": "https://account.atlassian.net/browse/PI-1",
"issueType": "Epic"
},
"relations": {}
}
Import Jira Historical Issues
In this example you are going to use the provided Python script to fetch data from the Jira API and ingest it to Port.
Prerequisites
This example utilizes the same blueprint and webhook definition from the previous section.
In addition, it requires a Jira API token that is provided as a parameter to the Python script
Create the Jira API token
- Log in to your Jira account.
- Click Create API token.
- From the dialog that appears, enter a memorable and concise Label for your token and click Create.
- Click Copy to copy the token to your clipboard, you will not have another opportunity to view the token value after you leave this page.
Use the following Python script to ingest historical Jira issues into port:
Jira Python script for historical issues
# Dependencies to Install
# pip install jira
# pip install requests
from jira import JIRA
import requests
import json
import os
def authenticate_with_jira(server, username, api_token):
# This function authenticates with JIRA and returns a JIRA object
return JIRA(server=server, basic_auth=(username, api_token))
def send_to_port(data, port_url):
# This function sends issue data to Port
headers = {'Content-Type': 'application/json'}
response = requests.post(port_url, headers=headers, data=json.dumps(data))
# Check the response from Port
if response.status_code != 202:
print(f"Error sending issue {data['issue']['key']} to Port: {response.status_code}")
else:
print(f"Issue {data['issue']['key']} successfully sent to Port.")
return response
def process_issues(issues):
# This function processes the issues from JIRA
total_issues_processed = 0
for issue in issues:
try:
description = issue.fields.description if issue.fields.description else None
data_to_send = {
"issue": {
"key": issue.key,
"fields": {
"summary": issue.fields.summary,
"description": description,
"status": {"name": issue.fields.status.name},
"issuetype": {"name": issue.fields.issuetype.name},
"self": issue.self,
},
"lastChangeType": "",
"self": issue.self,
},
"user": {"displayName": issue.fields.creator.displayName},
}
response = send_to_port(data_to_send, os.getenv('PORT_URL')) ## Your WEBHOOK_URL after creating the Port Webhook
if response.status_code == 202:
total_issues_processed += 1
except Exception as e:
print(f"Error processing issue {issue.key}: {str(e)}")
return total_issues_processed
def main():
jira_server = os.getenv('JIRA_SERVER') ## This is your Jira Domain https://{your_domain}.atlassian.net
username = os.getenv('USERNAMES')
api_token = os.getenv('API_TOKEN')
status_list = ["In Progress", "To Do"]
status = ','.join(f'"{s}"' for s in status_list)
jira = authenticate_with_jira(jira_server, username, api_token)
start_at = 0
max_results = 20
total_issues_processed = 0
while True:
issues = jira.search_issues(f'status in ({status})', startAt=start_at, maxResults=max_results)
if not issues:
break
total_issues_processed += process_issues(issues)
start_at += max_results
print(f"Total issues processed: {total_issues_processed}")
if __name__ == "__main__":
main()
The script requires the following environment variables:
PORT_URL
- the webhook URL generated by Port after creating the webhook configuration;JIRA_SERVER
- your Jira domain, for examplehttps://{YOUR_DOMAIN}.atlassian.net
;USERNAMES
- your Jira username;API_TOKEN
- your Jira API token (created in the previous step).
Done! you can now import historical issues from Jira into Port. Port will parse the issues according to the mapping and update the catalog entities accordingly.