Skip to main content

Linear

Our Linear integration allows you to import issues, teams, and labels from your Linear account into Port, according to your mapping and definition.

Common use cases

  • Map issues, teams and labels in your Linear workspace environment.
  • Watch for object changes (create/update/delete) in real-time, and automatically apply the changes to your entities in Port.
  • Create/delete Linear objects using self-service actions.

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.

Troubleshooting

If you are having trouble installing this integration, please refer to these troubleshooting steps.

Installation

Choose one of the following installation methods:

Using this installation option means that the integration will be able to update Port in real time using webhooks.

This table summarizes the available parameters for the installation. Set them as you wish in the script below, then copy it and run it in your terminal:

ParameterDescriptionExampleRequired
port.clientIdYour port client id
port.clientSecretYour port client secret
port.baseUrlYour Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US
integration.secrets.linearApiKeyLinear API key used to query the Linear GraphQL API
integration.config.appHostThe host of the Port Ocean app. Used to set up the integration endpoint as the target for webhooks created in Linearhttps://my-ocean-integration.com

Advanced configuration

ParameterDescription
integration.eventListener.typeThe event listener type. Read more about event listeners
integration.typeThe integration to be installed
scheduledResyncIntervalThe number of minutes between each resync. When not set the integration will resync for each event listener resync event. Read more about scheduledResyncInterval
initializePortResourcesDefault true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources

To install the integration using Helm, run the following command:

helm repo add --force-update port-labs https://port-labs.github.io/helm-charts
helm upgrade --install my-linear-integration port-labs/port-ocean \
--set port.clientId="PORT_CLIENT_ID" \
--set port.clientSecret="PORT_CLIENT_SECRET" \
--set port.baseUrl="https://api.getport.io" \
--set initializePortResources=true \
--set scheduledResyncInterval=120 \
--set integration.identifier="my-linear-integration" \
--set integration.type="linear" \
--set integration.eventListener.type="POLLING" \
--set integration.secrets.linearApiKey="string"
Selecting a Port API URL by account region

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.

Advanced integration configuration

For advanced configuration such as proxies or self-signed certificates, click here.

Ingesting Linear objects

The Linear integration uses a YAML configuration to describe the process of loading data into the developer portal.

Here is an example snippet from the config which demonstrates the process for getting team data from Linear:

createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: team
selector:
query: "true"
port:
entity:
mappings:
identifier: .key
title: .name
blueprint: '"linearTeam"'
properties:
description: .description
workspaceName: .organization.name
url: "\"https://linear.app/\" + .organization.urlKey + \"/team/\" + .key"

The integration makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from Linear's API events.

Additional parameters

In the example above, two additional parameters are used:
createMissingRelatedEntities - used to enable the creation of missing related entities in Port. This is useful when you want to create an entity and its related entities in one call, or if you want to create an entity whose related entity does not exist yet.

deleteDependentEntities - used to enable deletion of dependent Port entities. This is useful when you have two blueprints with a required relation, and the target entity in the relation should be deleted. In this scenario, the delete operation will fail if this parameter is set to false. If set to true, the source entity will be deleted as well.

Configuration structure

The integration configuration determines which resources will be queried from Linear, and which entities and properties will be created in Port.

Supported resources (Kind)

The following resources can be used to map data from Linear, it is possible to reference any field that appears in the API responses linked below for the mapping configuration.

  • The root key of the integration configuration is the resources key:

    resources:
    - kind: team
    selector:
    ...
  • The kind key is a specifier for a Linear object:

      resources:
    - kind: team
    selector:
    ...
  • The selector and the query keys allow you to filter which objects of the specified kind will be ingested into your software catalog:

    resources:
    - kind: team
    selector:
    query: "true" # JQ boolean expression. If evaluated to false - this object will be skipped.
    port:
  • The port, entity and the mappings keys are used to map the Linear object fields to Port entities. To create multiple mappings of the same kind, you can add another item in the resources array;

    resources:
    - kind: team
    selector:
    query: "true"
    port:
    entity:
    mappings: # Mappings between one Linear object to a Port entity. Each value is a JQ query.
    identifier: .key
    title: .name
    blueprint: '"linearTeam"'
    properties:
    description: .description
    workspaceName: .organization.name
    url: "\"https://linear.app/\" + .organization.urlKey + \"/team/\" + .key"
    - kind: team # In this instance project is mapped again with a different filter
    selector:
    query: '.name == "MyTeamName"'
    port:
    entity:
    mappings: ...
Blueprint key

Note the value of the blueprint key - if you want to use a hardcoded string, you need to encapsulate it in 2 sets of quotes, for example use a pair of single-quotes (') and then another pair of double-quotes (")

Ingest data into Port

To ingest Linear objects using the integration configuration, you can follow the steps below:

  1. Go to the DevPortal Builder page.
  2. Select a blueprint you want to ingest using Linear.
  3. Choose the Ingest Data option from the menu.
  4. Click on + Data source at the top right corner
  5. Select Linear under the Project management providers category.
  6. Modify the configuration according to your needs.
  7. Click Resync.

Examples

Examples of blueprints and the relevant integration configurations:

Team

Team blueprint
{
"identifier": "linearTeam",
"title": "Linear Team",
"icon": "Linear",
"description": "A Linear team",
"schema": {
"properties": {
"description": {
"type": "string",
"title": "Description",
"description": "Team description"
},
"workspaceName": {
"type": "string",
"title": "Workspace Name",
"description": "The name of the workspace this team belongs to"
},
"url": {
"title": "Team URL",
"type": "string",
"format": "url",
"description": "URL to the team in Linear"
}
}
},
"calculationProperties": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: team
selector:
query: "true"
port:
entity:
mappings:
identifier: .key
title: .name
blueprint: '"linearTeam"'
properties:
description: .description
workspaceName: .organization.name
url: "\"https://linear.app/\" + .organization.urlKey + \"/team/\" + .key"

Label

Label blueprint
{
"identifier": "linearLabel",
"title": "Linear Label",
"icon": "Linear",
"description": "A Linear label",
"schema": {
"properties": {
"isGroup": {
"type": "boolean",
"title": "Is group",
"description": "Whether this label is considered to be a group"
}
}
},
"calculationProperties": {},
"relations": {
"parentLabel": {
"target": "linearLabel",
"title": "Parent Label",
"required": false,
"many": false
},
"childLabels": {
"target": "linearLabel",
"title": "Child Labels",
"required": false,
"many": true
}
}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: label
selector:
query: "true"
port:
entity:
mappings:
identifier: .id
title: .name
blueprint: '"linearLabel"'
properties:
isGroup: .isGroup
relations:
parentLabel: .parent.id
childLabels: "[.children.edges[].node.id]"

Issue

Issue blueprint
{
"identifier": "linearIssue",
"title": "Linear Issue",
"icon": "Linear",
"schema": {
"properties": {
"url": {
"title": "Issue URL",
"type": "string",
"format": "url",
"description": "URL to the issue in Linear"
},
"status": {
"title": "Status",
"type": "string",
"description": "The status of the issue"
},
"assignee": {
"title": "Assignee",
"type": "string",
"format": "user",
"description": "The user assigned to the 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"
},
"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"
}
}
},
"calculationProperties": {},
"relations": {
"team": {
"target": "linearTeam",
"title": "Team",
"description": "The Linear team that contains this issue",
"required": false,
"many": false
},
"parentIssue": {
"title": "Parent Issue",
"target": "linearIssue",
"required": false,
"many": false
},
"labels": {
"target": "linearLabel",
"title": "Labels",
"required": false,
"many": true
}
}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: issue
selector:
query: "true"
port:
entity:
mappings:
identifier: .identifier
title: .title
blueprint: '"linearIssue"'
properties:
url: .url
status: .state.name
assignee: .assignee.email
creator: .creator.email
priority: .priorityLabel
created: .createdAt
updated: .updatedAt
relations:
team: .team.key
labels: .labelIds
parentIssue: .parent.identifier

Let's Test It

This section includes a sample response data from Linear. 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 Linear:

Team response data
{
"id": "92d25fa4-fb1c-449f-b314-47f82e8f280d",
"name": "Port",
"key": "POR",
"description": null,
"organization": {
"id": "36968e1b-496c-4610-8c25-641364da172e",
"name": "Getport",
"urlKey": "getport"
}
}
Label response data
{
"id": "36f84d2c-7b7d-4a71-96f2-6ea4140004d5",
"createdAt": "2024-05-17T15:17:40.858Z",
"updatedAt": "2024-05-17T15:17:40.858Z",
"archivedAt": null,
"name": "New-sample-label",
"description": null,
"color": "#bec2c8",
"isGroup": true,
"parent": null,
"children": {
"edges": [
{
"node": {
"id": "2e483c90-2aca-4db6-924d-b0571d49f691"
}
}
]
}
}
Issue response data
{
"id": "9b4745c2-a8e6-4432-9e56-0fa97b79ccbf",
"createdAt": "2024-05-16T21:52:00.299Z",
"updatedAt": "2024-05-17T09:27:40.077Z",
"archivedAt": null,
"number": 2,
"title": "sub issue with new title",
"priority": 3,
"estimate": null,
"sortOrder": -991,
"startedAt": null,
"completedAt": null,
"startedTriageAt": null,
"triagedAt": null,
"canceledAt": null,
"autoClosedAt": null,
"autoArchivedAt": null,
"dueDate": null,
"slaStartedAt": null,
"slaBreachesAt": null,
"trashed": null,
"snoozedUntilAt": null,
"labelIds": [
"402b218c-938c-4ddf-85db-0019bc632316"
],
"previousIdentifiers": [],
"subIssueSortOrder": -56.17340471045278,
"priorityLabel": "Medium",
"integrationSourceType": null,
"identifier": "POR-2",
"url": "https://linear.app/getport/issue/POR-2/sub-issue-with-new-title",
"branchName": "mor/por-2-sub-issue-with-new-title",
"customerTicketCount": 0,
"description": "",
"descriptionState": "AQG/pOWPAgAHAQtwcm9zZW1pcnJvcgMJcGFyYWdyYXBoAA==",
"team": {
"id": "92d25fa4-fb1c-449f-b314-47f82e8f280d",
"name": "Port",
"key": "POR"
},
"state": {
"name": "Todo"
},
"creator": {
"name": "Mor Paz",
"email": "mor@getport.io"
},
"assignee": {
"name": "Dudi Elhadad",
"email": "dudi@getport.io"
},
"parent": {
"id": "5ddd8e85-ad89-4c96-b901-0b901b29100d",
"identifier": "POR-1"
}
}

Mapping Result

The combination of the sample payload and the Ocean configuration generates the following Port entity:

Team entity in Port
{
"identifier": "POR",
"title": "Port",
"icon": null,
"blueprint": "linearTeam",
"team": [],
"properties": {
"url": "https://linear.app/getport/team/POR",
"workspaceName": "Getport"
},
"relations": {},
"createdAt": "2024-05-19T16:19:15.232Z",
"createdBy": "KZ5zDPudPshQMShUb4cLopBEE1fNSJGE",
"updatedAt": "2024-05-19T16:19:15.232Z",
"updatedBy": "KZ5zDPudPshQMShUb4cLopBEE1fNSJGE"
}
Label entity in Port
{
"identifier": "36f84d2c-7b7d-4a71-96f2-6ea4140004d5",
"title": "New-sample-label",
"icon": null,
"blueprint": "linearLabel",
"team": [],
"properties": {
"isGroup": false
},
"relations": {
"childLabels": [],
"parentLabel": null
},
"createdAt": "2024-05-19T16:19:17.747Z",
"createdBy": "KZ5zDPudPshQMShUb4cLopBEE1fNSJGE",
"updatedAt": "2024-05-19T16:19:17.747Z",
"updatedBy": "KZ5zDPudPshQMShUb4cLopBEE1fNSJGE"
}
Issue entity in Port
{
"identifier": "POR-2",
"title": "sub issue with new title",
"icon": null,
"blueprint": "linearIssue",
"team": [],
"properties": {
"status": "Todo",
"url": "https://linear.app/getport/issue/POR-2/sub-issue-with-new-title",
"created": "2024-05-16T21:52:00.299Z",
"priority": "Medium",
"assignee": "dudi@getport.io",
"updated": "2024-05-17T09:27:40.077Z",
"creator": "mor@getport.io"
},
"relations": {
"team": "POR",
"labels": [
"402b218c-938c-4ddf-85db-0019bc632316"
],
"parentIssue": "POR-1"
},
"createdAt": "2024-05-19T16:19:21.143Z",
"createdBy": "KZ5zDPudPshQMShUb4cLopBEE1fNSJGE",
"updatedAt": "2024-05-19T16:19:21.143Z",
"updatedBy": "KZ5zDPudPshQMShUb4cLopBEE1fNSJGE"
}

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 Linear. If so, use the following instructions:

Webhook installation (click to expand)

In this example you are going to create a webhook integration between Linear and Port, which will ingest Linear issue entities.

Port configuration

Create the following blueprint definition:

Linear issue blueprint
{
"identifier": "linearIssue",
"title": "Linear Issue",
"icon": "Linear",
"schema": {
"properties": {
"url": {
"title": "Issue URL",
"type": "string",
"format": "url",
"description": "URL to the issue in Linear"
},
"status": {
"title": "Status",
"type": "string",
"description": "The status of the issue"
},
"assignee": {
"title": "Assignee",
"type": "string",
"format": "user",
"description": "The user assigned to the 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"
},
"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"
}
}
},
"calculationProperties": {},
"relations": {}
}

Create the following webhook configuration using Port's UI

Linear issue webhook configuration
  1. Basic details tab - fill the following details:

    1. Title : Linear mapper;
    2. Identifier : linear_mapper;
    3. Description : A webhook configuration to map Linear issues to Port;
    4. Icon : Linear;
  2. Integration configuration tab - fill the following JQ mapping:

    [
    {
    "blueprint": "linearIssue",
    "entity": {
    "identifier": ".body.data.identifier",
    "title": ".body.data.title",
    "properties": {
    "url": ".body.data.url",
    "status": ".body.data.state.name",
    "assignee": ".body.data.assignee.email",
    "creator": ".body.data.creator.email",
    "priority": ".body.data.priorityLabel",
    "created": ".body.data.createdAt",
    "updated": ".body.data.updatedAt"
    }
    }
    }
    ]
  3. Click Save at the bottom of the page.

Create a webhook in Linear

You can follow the instruction in Linear's docs, they are also outlined here for reference:

  1. Log in to Linear as a user with admin permissions.
  2. Click the workspace label at the top left corner.
  3. Choose Workspace Settings.
  4. At the bottom of the sidebar on the left, under My Account, choose API.
  5. Click on Create new webhook.
  6. Input the following details:
    1. Label - use a meaningful name such as Port Webhook.
    2. URL - enter the value of the url key you received after creating the webhook configuration.
    3. Under Data change events - mark issues.
  7. Click Create webhook at the bottom of the page.
Linear events and payload

In order to view the different payloads and events available in Linear webhooks, look here

Done! any change you make to an issue (open, close, edit, etc.) will trigger a webhook event that Linear 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 Linear 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 Linear issue is created:

Webhook event payload
{
"action": "create",
"actor": {
"id": "11c5ce7d-229b-4487-b23b-f404e4a8c85d",
"name": "Mor Paz",
"type": "user"
},
"createdAt": "2024-05-19T17:55:29.277Z",
"data": {
"id": "d62a755d-5389-4dbd-98bb-3db03f239d9d",
"createdAt": "2024-05-19T17:55:29.277Z",
"updatedAt": "2024-05-19T17:55:29.277Z",
"number": 5,
"title": "New issue again",
"priority": 0,
"boardOrder": 0,
"sortOrder": -3975,
"labelIds": [],
"teamId": "92d25fa4-fb1c-449f-b314-47f82e8f280d",
"previousIdentifiers": [],
"creatorId": "11c5ce7d-229b-4487-b23b-f404e4a8c85d",
"stateId": "f12cad17-9b8f-470d-b20a-5e17da8e46b9",
"priorityLabel": "No priority",
"botActor": null,
"identifier": "POR-5",
"url": "https://linear.app/getport/issue/POR-5/new-issue-again",
"state": {
"id": "f12cad17-9b8f-470d-b20a-5e17da8e46b9",
"color": "#e2e2e2",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "92d25fa4-fb1c-449f-b314-47f82e8f280d",
"key": "POR",
"name": "Port"
},
"subscriberIds": [
"11c5ce7d-229b-4487-b23b-f404e4a8c85d"
],
"labels": []
},
"url": "https://linear.app/getport/issue/POR-5/new-issue-again",
"type": "Issue",
"organizationId": "36968e1b-496c-4610-8c25-641364da172e",
"webhookTimestamp": 1716141329394,
"webhookId": "ee1fa20e-6b57-4448-86f7-39d9672ddedd"
}

Mapping Result

The combination of the sample payload and the webhook configuration generates the following Port entity:

{
"identifier": "POR-5",
"title": "New issue again",
"team": [],
"properties": {
"status": "Todo",
"url": "https://linear.app/getport/issue/POR-5/new-issue-again",
"created": "2024-05-19T17:55:29.277Z",
"priority": "No priority",
"updated": "2024-05-19T17:55:29.277Z"
},
"relations": {
"labels": []
},
"icon": "Linear"
}