Skip to content

Commit 536f55d

Browse files
authored
Merge pull request #6 from dataiku/chore/sc-261491-jira-migrate-to-search-endpoint
fix: [sc-261491] JIRA: migrate to the new search endpoint + assess if other endpoints should be migrated
2 parents 1243c9c + 498c84a commit 536f55d

File tree

8 files changed

+71
-17
lines changed

8 files changed

+71
-17
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Changelog
2+
3+
## [Version 1.1.2](https://github.com/dataiku/dss-plugin-jira/releases/tag/v1.1.2) - Bug Fix release - 2025-08-25
4+
5+
- Adding new search/jql endpoint, marking previous search endpoint as deprecated
6+
27
## [Version 1.1.1](https://github.com/dataiku/dss-plugin-jira/releases/tag/v1.1.1) - Bug Fix release - 2025-05-12
38

49
- Fixed appropriate trace logging

custom-recipes/jira-services/recipe.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@
7272
},
7373
{
7474
"value": "search",
75-
"label": "Core: Search issues"
75+
"label": "Core: Search issues (Deprecated)"
76+
},
77+
{
78+
"value": "search/jql",
79+
"label": "Core: Search issues (JQL)"
7680
},
7781
{
7882
"value": "project/versions",
@@ -166,7 +170,7 @@
166170
"columnRole": "input_datasets_name",
167171
"description": "Name of the column containing the JQL search strings",
168172
"mandatory": true,
169-
"visibilityCondition": "model.endpoint_name== 'search'"
173+
"visibilityCondition": "model.endpoint_name== 'search' || model.endpoint_name== 'search/jql'"
170174
},
171175
{
172176
"name": "id_column_name",
@@ -232,7 +236,7 @@
232236
"name": "expand",
233237
"label": "Expand",
234238
"type": "MULTISELECT",
235-
"visibilityCondition": "['search', 'board/issue', 'epic/none/issue'].indexOf(model.endpoint_name) >= 0",
239+
"visibilityCondition": "['search', 'search/jql', 'board/issue', 'epic/none/issue'].indexOf(model.endpoint_name) >= 0",
236240
"selectChoices": [
237241
{"value": "changelog", "label": "Change logs"},
238242
{"value": "renderedFields", "label": "Rendered fields"},
@@ -264,6 +268,19 @@
264268
{"value": "issuesstatus", "label": "Issue status"},
265269
{"value": "operations", "label": "Operations"}
266270
]
271+
},
272+
{
273+
"name": "fields",
274+
"label": "Fields",
275+
"type": "MULTISELECT",
276+
"visibilityCondition": "['search/jql'].indexOf(model.endpoint_name) >= 0",
277+
"defaultValue": ["*all"],
278+
"selectChoices": [
279+
{"value": "*all", "label": "All"},
280+
{"value": "summary", "label": "Summary"},
281+
{"value": "comment", "label": "Comments"},
282+
{"value": "description", "label": "Description"}
283+
]
267284
}
268285
],
269286
"resourceKeys": []

custom-recipes/jira-services/recipe.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
queue_id_column_name = config.get('queue_id_column_name', None)
1717
de_float_column(id_list_df, queue_id_column_name)
1818

19-
access_type = get_recipe_config()['access_type']
20-
connection_details = get_recipe_config()[access_type]
21-
endpoint_name = get_recipe_config()['endpoint_name']
22-
expand = get_recipe_config()['expand']
19+
access_type = config.get('access_type')
20+
connection_details = config.get(access_type)
21+
endpoint_name = config.get('endpoint_name')
22+
expand = config.get('expand')
23+
fields = config.get('fields')
2324

2425
client = JiraClient(connection_details)
2526
client.start_session(endpoint_name)
@@ -36,7 +37,7 @@
3637
else:
3738
queue_id = None
3839

39-
data = client.get_endpoint(endpoint_name, jira_id, "", expand=expand, raise_exception=False, queue_id=queue_id)
40+
data = client.get_endpoint(endpoint_name, jira_id, "", expand=expand, fields=fields, raise_exception=False, queue_id=queue_id)
4041
while len(data) > 0:
4142
for result in data:
4243
record = dict(indexes_columns)

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "jira",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"meta": {
55
"label": "Jira",
66
"description": "Import data from your Jira account",

python-connectors/jira/connector.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@
3636
"selectChoices": [
3737
{
3838
"value": "search",
39-
"label": "Core: Search issues"
39+
"label": "Core: Search issues (Deprecated)"
40+
},
41+
{
42+
"value": "search/jql",
43+
"label": "Core: Search issues (JQL)"
4044
},
4145
{
4246
"value": "dashboard",
@@ -156,7 +160,7 @@
156160
"label": "JQL search query",
157161
"type": "STRING",
158162
"defaultValue": null,
159-
"visibilityCondition": "model.endpoint_name == 'search' || model.endpoint_name == 'jql/match'"
163+
"visibilityCondition": "model.endpoint_name == 'search' || model.endpoint_name == 'jql/match' || model.endpoint_name == 'search/jql'"
160164
},
161165
{
162166
"name": "expand",
@@ -201,7 +205,7 @@
201205
"name": "expand",
202206
"label": "Expand",
203207
"type": "MULTISELECT",
204-
"visibilityCondition": "['search', 'board/issue', 'epic/none/issue'].indexOf(model.endpoint_name) >= 0",
208+
"visibilityCondition": "['search', 'search/jql', 'board/issue', 'epic/none/issue'].indexOf(model.endpoint_name) >= 0",
205209
"selectChoices": [
206210
{"value": "changelog", "label": "Change logs"},
207211
{"value": "renderedFields", "label": "Rendered fields"},
@@ -210,6 +214,19 @@
210214
{"value": "versionedRepresentations", "label": "Versioned representations"}
211215
]
212216
},
217+
{
218+
"name": "fields",
219+
"label": "Fields",
220+
"type": "MULTISELECT",
221+
"visibilityCondition": "['search/jql'].indexOf(model.endpoint_name) >= 0",
222+
"defaultValue": ["*all"],
223+
"selectChoices": [
224+
{"value": "*all", "label": "All"},
225+
{"value": "summary", "label": "Summary"},
226+
{"value": "comment", "label": "Comments"},
227+
{"value": "description", "label": "Description"}
228+
]
229+
},
213230
{
214231
"name": "item_value",
215232
"label": "Organization ID",

python-connectors/jira/connector.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def __init__(self, config, plugin_config):
1919
self.data = self.config.get("data", None)
2020
self.queue_id = self.config.get("queue_id", None)
2121
self.expand = self.config.get("expand", [])
22+
self.fields = self.config.get("fields", [])
2223
connection_details = self.config.get(self.access_type)
2324
self.client = JiraClient(connection_details)
2425

@@ -29,7 +30,7 @@ def generate_rows(self, dataset_schema=None, dataset_partitioning=None,
2930
partition_id=None, records_limit=-1):
3031
logger.info("JiraConnector:generate_rows")
3132
self.client.start_session(self.endpoint_name)
32-
data = self.client.get_endpoint(self.endpoint_name, self.item_value, self.data, queue_id=self.queue_id, expand=self.expand)
33+
data = self.client.get_endpoint(self.endpoint_name, self.item_value, self.data, queue_id=self.queue_id, expand=self.expand, fields=self.fields)
3334
counter = 0
3435
while len(data) > 0:
3536
for result in data:

python-lib/jira_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@
108108
200: "issues"
109109
}
110110
},
111+
"search/jql": {
112+
API_RESOURCE: "search/jql",
113+
API_QUERY_STRING: {"jql": ITEM_VALUE, "expand": "{expand}", "fields": "{fields}"},
114+
API_RETURN: {
115+
200: "issues"
116+
}
117+
},
111118
"worklog/deleted": {},
112119
"worklog/list": {
113120
API_RESOURCE: "issue/{item_value}/worklog",

python-lib/jira_client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def get_resource_name(self, endpoint_name, item_value, queue_id):
7575
def get_ressource_structure(self):
7676
return self.endpoint_descriptor[api.API_RESOURCE]
7777

78-
def get_endpoint(self, endpoint_name, item_value, data, queue_id=None, expand=[], raise_exception=True):
78+
def get_endpoint(self, endpoint_name, item_value, data, queue_id=None, expand=[], fields=[], raise_exception=True):
7979
self.endpoint_name = endpoint_name
80-
self.params = self.get_params(endpoint_name, item_value, queue_id, expand)
80+
self.params = self.get_params(endpoint_name, item_value, queue_id, expand, fields)
8181
url = self.get_url(endpoint_name, item_value, queue_id)
8282
self.start_paging(counting_key=self.get_data_filter_key(), url=url)
8383
response = self.get(url, data, params=self.params)
@@ -104,12 +104,18 @@ def start_paging(self, counting_key, url):
104104
self.pagination.configure_paging(pagination_config)
105105
self.pagination.reset_paging(counting_key=self.get_data_filter_key(), url=url)
106106

107-
def get_params(self, endpoint_name, item_value, queue_id, expand=[]):
107+
def get_params(self, endpoint_name, item_value, queue_id, expand=[], fields=[]):
108108
ret = {}
109109
query_string_dict = self.get_query_string_dict()
110110
for key in query_string_dict:
111111
query_string_template = query_string_dict[key]
112-
query_string_value = query_string_template.format(endpoint_name=endpoint_name, item_value=item_value, queue_id=queue_id, expand=",".join(expand))
112+
query_string_value = query_string_template.format(
113+
endpoint_name=endpoint_name,
114+
item_value=item_value,
115+
queue_id=queue_id,
116+
expand=",".join(expand),
117+
fields=",".join(fields)
118+
)
113119
ret.update({key: query_string_value})
114120
return ret
115121

0 commit comments

Comments
 (0)