Source Jira: add new stream IssueTransitions (#30507)
This commit is contained in:
@@ -12,5 +12,5 @@ RUN pip install .
|
||||
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
|
||||
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
|
||||
|
||||
LABEL io.airbyte.version=0.5.0
|
||||
LABEL io.airbyte.version=0.6.0
|
||||
LABEL io.airbyte.name=airbyte/source-jira
|
||||
|
||||
@@ -214,6 +214,16 @@
|
||||
},
|
||||
"sync_mode": "full_refresh",
|
||||
"destination_sync_mode": "append"
|
||||
},
|
||||
{
|
||||
"stream": {
|
||||
"name": "issue_transitions",
|
||||
"json_schema": {},
|
||||
"supported_sync_modes": ["full_refresh"],
|
||||
"source_defined_primary_key": [["issueId"], ["id"]]
|
||||
},
|
||||
"sync_mode": "full_refresh",
|
||||
"destination_sync_mode": "append"
|
||||
},
|
||||
{
|
||||
"stream": {
|
||||
|
||||
@@ -58,6 +58,13 @@
|
||||
{"stream": "issue_security_schemes", "data": {"self": "https://airbyteio.atlassian.net/rest/api/3/issuesecurityschemes/10001", "id": 10001, "name": "Security scheme 2", "description": "Security scheme 2"}, "emitted_at": 1685112999194}
|
||||
{"stream": "issue_security_schemes", "data": {"self": "https://airbyteio.atlassian.net/rest/api/3/issuesecurityschemes/10000", "id": 10000, "name": "Security scheme 1", "description": "Security scheme 1", "defaultSecurityLevelId": 10002}, "emitted_at": 1685112999195}
|
||||
{"stream": "issue_security_schemes", "data": {"self": "https://airbyteio.atlassian.net/rest/api/3/issuesecurityschemes/10002", "id": 10002, "name": "Security scheme 3", "description": "Security scheme 3 test", "defaultSecurityLevelId": 10003}, "emitted_at": 1685112999195}
|
||||
{"stream":"issue_transitions","data":{"id":"11","name":"To Do","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/10000","description":"","iconUrl":"https://airbyteio.atlassian.net/","name":"To Do","id":"10000","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"IT-26"},"emitted_at":1694797618551}
|
||||
{"stream":"issue_transitions","data":{"id":"21","name":"In Progress","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/3","description":"This issue is being actively worked on at the moment by the assignee.","iconUrl":"https://airbyteio.atlassian.net/images/icons/statuses/inprogress.png","name":"In Progress","id":"3","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/4","id":4,"key":"indeterminate","colorName":"yellow","name":"In Progress"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"IT-26"},"emitted_at":1694797618551}
|
||||
{"stream":"issue_transitions","data":{"id":"31","name":"Done","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/10001","description":"","iconUrl":"https://airbyteio.atlassian.net/","name":"Done","id":"10001","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"IT-26"},"emitted_at":1694797618551}
|
||||
{"stream":"issue_transitions","data":{"id":"101","name":"Closed","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/6","description":"The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.","iconUrl":"https://airbyteio.atlassian.net/images/icons/statuses/closed.png","name":"Closed","id":"6","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"IT-1"},"emitted_at":1694797626847}
|
||||
{"stream":"issue_transitions","data":{"id":"11","name":"To Do","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/10000","description":"","iconUrl":"https://airbyteio.atlassian.net/","name":"To Do","id":"10000","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"TESTKEY13-2"},"emitted_at":1694797627727}
|
||||
{"stream":"issue_transitions","data":{"id":"21","name":"In Progress","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/3","description":"This issue is being actively worked on at the moment by the assignee.","iconUrl":"https://airbyteio.atlassian.net/images/icons/statuses/inprogress.png","name":"In Progress","id":"3","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/4","id":4,"key":"indeterminate","colorName":"yellow","name":"In Progress"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"TESTKEY13-2"},"emitted_at":1694797627728}
|
||||
{"stream":"issue_transitions","data":{"id":"31","name":"Done","to":{"self":"https://airbyteio.atlassian.net/rest/api/3/status/10001","description":"","iconUrl":"https://airbyteio.atlassian.net/","name":"Done","id":"10001","statusCategory":{"self":"https://airbyteio.atlassian.net/rest/api/3/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false,"issueId":"TESTKEY13-2"},"emitted_at":1694797627728}
|
||||
{"stream": "issue_type_schemes", "data": {"id": "10000", "name": "Default Issue Type Scheme", "description": "Default issue type scheme is the list of global issue types. All newly created issue types will automatically be added to this scheme.", "isDefault": true}, "emitted_at": 1685112999823}
|
||||
{"stream": "issue_type_schemes", "data": {"id": "10126", "name": "IT: Scrum Issue Type Scheme", "defaultIssueTypeId": "10001"}, "emitted_at": 1685112999824}
|
||||
{"stream": "issue_type_schemes", "data": {"id": "10128", "name": "P2: Scrum Issue Type Scheme", "defaultIssueTypeId": "10001"}, "emitted_at": 1685112999824}
|
||||
|
||||
@@ -5,7 +5,7 @@ data:
|
||||
connectorSubtype: api
|
||||
connectorType: source
|
||||
definitionId: 68e63de2-bb83-4c7e-93fa-a8a9051e3993
|
||||
dockerImageTag: 0.5.0
|
||||
dockerImageTag: 0.6.0
|
||||
maxSecondsBetweenMessages: 21600
|
||||
dockerRepository: airbyte/source-jira
|
||||
githubIssueLabel: source-jira
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft-07/schema#",
|
||||
"title": "Issue Transitions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fields": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"hasScreen": {
|
||||
"type": ["null", "boolean"]
|
||||
},
|
||||
"id": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"issueId": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"isAvailable": {
|
||||
"type": ["null", "boolean"]
|
||||
},
|
||||
"isConditional": {
|
||||
"type": ["null", "boolean"]
|
||||
},
|
||||
"isGlobal": {
|
||||
"type": ["null", "boolean"]
|
||||
},
|
||||
"isInitial": {
|
||||
"type": ["null", "boolean"]
|
||||
},
|
||||
"isLooped": {
|
||||
"type": ["null", "boolean"]
|
||||
},
|
||||
"name": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"to": {
|
||||
"type": ["null", "object"],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"iconUrl": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"id": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"name": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"self": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"statusCategory": {
|
||||
"type": ["null", "object"],
|
||||
"properties": {
|
||||
"colorName": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"id": {
|
||||
"type": ["null", "integer"]
|
||||
},
|
||||
"key": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"name": {
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"self": {
|
||||
"type": ["null", "string"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ from .streams import (
|
||||
IssueResolutions,
|
||||
Issues,
|
||||
IssueSecuritySchemes,
|
||||
IssueTransitions,
|
||||
IssueTypeSchemes,
|
||||
IssueTypeScreenSchemes,
|
||||
IssueVotes,
|
||||
@@ -111,6 +112,7 @@ class SourceJira(AbstractSource):
|
||||
issues_stream = Issues(
|
||||
**incremental_args,
|
||||
expand_changelog=config.get("expand_issue_changelog", False),
|
||||
expand_transitions=config.get("expand_issue_transition", False),
|
||||
render_fields=render_fields,
|
||||
)
|
||||
issue_fields_stream = IssueFields(**args)
|
||||
@@ -141,6 +143,7 @@ class SourceJira(AbstractSource):
|
||||
IssueRemoteLinks(**incremental_args),
|
||||
IssueResolutions(**args),
|
||||
IssueSecuritySchemes(**args),
|
||||
IssueTransitions(**args),
|
||||
IssueTypeSchemes(**args),
|
||||
IssueTypeScreenSchemes(**args),
|
||||
IssueVotes(**incremental_args),
|
||||
|
||||
@@ -64,12 +64,19 @@
|
||||
"default": false,
|
||||
"order": 6
|
||||
},
|
||||
"expand_issue_transition": {
|
||||
"type": "boolean",
|
||||
"title": "Expand Issue Transitions",
|
||||
"description": "Expand the transitions when replicating issues.",
|
||||
"default": false,
|
||||
"order": 7
|
||||
},
|
||||
"enable_experimental_streams": {
|
||||
"type": "boolean",
|
||||
"title": "Enable Experimental Streams",
|
||||
"description": "Allow the use of experimental streams which rely on undocumented Jira API endpoints. See https://docs.airbyte.com/integrations/sources/jira#experimental-tables for more info.",
|
||||
"default": false,
|
||||
"order": 7
|
||||
"order": 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,9 +347,10 @@ class Issues(IncrementalJiraStream):
|
||||
|
||||
skip_http_status_codes = [requests.codes.FORBIDDEN]
|
||||
|
||||
def __init__(self, expand_changelog: bool = False, render_fields: bool = False, **kwargs):
|
||||
def __init__(self, expand_changelog: bool = False, render_fields: bool = False, expand_transitions: bool = False, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self._expand_changelog = expand_changelog
|
||||
self._expand_transitions = expand_transitions
|
||||
self._render_fields = render_fields
|
||||
self._project_ids = []
|
||||
self.issue_fields_stream = IssueFields(authenticator=self.authenticator, domain=self._domain, projects=self._projects)
|
||||
@@ -373,6 +374,8 @@ class Issues(IncrementalJiraStream):
|
||||
expand = []
|
||||
if self._expand_changelog:
|
||||
expand.append("changelog")
|
||||
if self._expand_transitions:
|
||||
expand.append("transitions")
|
||||
if self._render_fields:
|
||||
expand.append("renderedFields")
|
||||
if expand:
|
||||
@@ -676,6 +679,38 @@ class IssueTypeScreenSchemes(JiraStream):
|
||||
return "issuetypescreenscheme"
|
||||
|
||||
|
||||
class IssueTransitions(StartDateJiraStream):
|
||||
"""
|
||||
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get
|
||||
"""
|
||||
|
||||
primary_key = ["issueId", "id"]
|
||||
extract_field = "transitions"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.issues_stream = Issues(
|
||||
authenticator=self.authenticator,
|
||||
domain=self._domain,
|
||||
projects=self._projects,
|
||||
start_date=self._start_date,
|
||||
)
|
||||
|
||||
def path(self, stream_slice: Mapping[str, Any], **kwargs) -> str:
|
||||
return f"issue/{stream_slice['key']}/transitions"
|
||||
|
||||
def read_records(self, stream_slice: Optional[Mapping[str, Any]] = None, **kwargs) -> Iterable[Mapping[str, Any]]:
|
||||
for issue in read_full_refresh(self.issues_stream):
|
||||
yield from super().read_records(stream_slice={"key": issue["key"]}, **kwargs)
|
||||
|
||||
def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
|
||||
return None
|
||||
|
||||
def transform(self, record: MutableMapping[str, Any], stream_slice: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]:
|
||||
record["issueId"] = stream_slice["key"]
|
||||
return record
|
||||
|
||||
|
||||
class IssueVotes(StartDateJiraStream):
|
||||
"""
|
||||
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-votes/#api-rest-api-3-issue-issueidorkey-votes-get
|
||||
|
||||
@@ -14,7 +14,7 @@ from source_jira.source import SourceJira
|
||||
def test_streams(config):
|
||||
source = SourceJira()
|
||||
streams = source.streams(config)
|
||||
expected_streams_number = 51
|
||||
expected_streams_number = 52
|
||||
assert len(streams) == expected_streams_number
|
||||
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ The Jira connector should not run into Jira API limitations under normal usage.
|
||||
|
||||
| Version | Date | Pull Request | Subject |
|
||||
|:--------|:-----------|:-----------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------|
|
||||
| 0.6.0 | 2023-09-17 | [\#30507](https://github.com/airbytehq/airbyte/pull/30507) | Add new stream `IssueTransitions` |
|
||||
| 0.5.0 | 2023-09-14 | [\#29960](https://github.com/airbytehq/airbyte/pull/29960) | Add `boardId` to `sprints` stream |
|
||||
| 0.3.14 | 2023-09-11 | [\#30297](https://github.com/airbytehq/airbyte/pull/30297) | Remove `requests` and `pendulum` from setup dependencies |
|
||||
| 0.3.13 | 2023-09-01 | [\#30108](https://github.com/airbytehq/airbyte/pull/30108) | Skip 404 error for stream `IssueWatchers` |
|
||||
|
||||
Reference in New Issue
Block a user