From 6e821a2f1eee6dfd825dff8ce26df84320d54b7d Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Thu, 15 Aug 2024 20:32:46 +0700 Subject: [PATCH 1/7] allow use of json-path-like syntax --- python-lib/jira_client.py | 3 ++- python-lib/pagination.py | 5 ++++- python-lib/utils.py | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/python-lib/jira_client.py b/python-lib/jira_client.py index a3656a4..30cac78 100644 --- a/python-lib/jira_client.py +++ b/python-lib/jira_client.py @@ -5,6 +5,7 @@ import os import jira_api as api from pagination import Pagination +from utils import extract_data_with_json_path FILTERING_KEY_WITHOUT_PARAMETER = 0 FILTERING_KEY_WITH_PARAMETER = 1 @@ -147,7 +148,7 @@ def filter_data(self, data, item_value): if filtering_key is None: return arrayed(data) else: - return arrayed(data[filtering_key]) + return arrayed(extract_data_with_json_path(data,filtering_key)) def format_data(self, data): for key in self.formating: diff --git a/python-lib/pagination.py b/python-lib/pagination.py index 02a7c1d..9e687ec 100644 --- a/python-lib/pagination.py +++ b/python-lib/pagination.py @@ -1,3 +1,6 @@ +from utils import extract_data_with_json_path + + class Pagination(object): def __init__(self): @@ -47,7 +50,7 @@ def update_next_page(self, data): else: counting_key = self.counting_key if counting_key is not None: - batch_size = len(data.get(counting_key)) + batch_size = len(extract_data_with_json_path(data, counting_key)) else: self.is_last_page = True batch_size = 1 diff --git a/python-lib/utils.py b/python-lib/utils.py index f2d090f..c6e8fa6 100644 --- a/python-lib/utils.py +++ b/python-lib/utils.py @@ -9,3 +9,12 @@ def de_float_column(dataframe, column_name): dataframe[column_name] = dataframe[column_name].astype(int) dataframe[column_name] = dataframe[column_name].astype(str) dataframe[column_name] = dataframe[column_name].replace('-1', np.nan) + + +def extract_data_with_json_path(data, json_path): + if not json_path: + return data + keys = json_path.split(".") + for key in keys: + data = data.get(key, {}) + return data \ No newline at end of file From 4364d4cacb4c917f7e4bfbf80890fc34e94042ad Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Thu, 15 Aug 2024 20:33:32 +0700 Subject: [PATCH 2/7] Adding endpoint def to retrieve issue comments --- python-lib/jira_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python-lib/jira_api.py b/python-lib/jira_api.py index 63300da..bd6cb55 100644 --- a/python-lib/jira_api.py +++ b/python-lib/jira_api.py @@ -60,6 +60,10 @@ "issue": { API_QUERY_STRING: {"expand": "{expand}"} }, + "issue/comments": { + API_RESOURCE: "issue/{item_value}", + API_RETURN: {200: "fields.comment.comments"} + }, "issue/createmeta": { API_RESOURCE: "{endpoint_name}", API_RETURN: { From 12f8e6917282c54cb082f7c313a0916574d4ea3f Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Thu, 15 Aug 2024 20:35:35 +0700 Subject: [PATCH 3/7] Adding use of comments api to custom recipe --- custom-recipes/jira-services/recipe.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom-recipes/jira-services/recipe.json b/custom-recipes/jira-services/recipe.json index f16e969..518588b 100644 --- a/custom-recipes/jira-services/recipe.json +++ b/custom-recipes/jira-services/recipe.json @@ -58,6 +58,10 @@ "value": "issue", "label": "Core: Issue" }, + { + "value": "issue/comments", + "label": "Core: Issue comments" + }, { "value": "dashboard", "label": "Core: Dashboard list" @@ -207,7 +211,7 @@ "columnRole": "input_datasets_name", "description": "Name of the column containing the IDs to process", "mandatory": true, - "visibilityCondition": "['board', 'board/epic', 'board/issue', 'project/versions', 'board/backlog', 'board/sprint', 'board/version', 'project/components'].indexOf(model.endpoint_name) >= 0" + "visibilityCondition": "['issue/comments', 'board', 'board/epic', 'board/issue', 'project/versions', 'board/backlog', 'board/sprint', 'board/version', 'project/components'].indexOf(model.endpoint_name) >= 0" }, { "name": "expand", From 4238d44a8c3e9a216700890fab58683cd197efff Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Thu, 15 Aug 2024 20:35:42 +0700 Subject: [PATCH 4/7] version update --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index e0749f8..5afc5f7 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "id": "jira", - "version": "1.0.0", + "version": "1.0.1", "meta": { "label": "Jira", "description": "Import data from your Jira account", From 2b95c8acdee8dd764ff58827d14607eafc58dc74 Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Thu, 15 Aug 2024 20:36:14 +0700 Subject: [PATCH 5/7] adding changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f063ef5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## [Version 1.0.1](https://github.com/dataiku/dss-plugin-jira/releases/tag/v1.0.1) - Feature release - 2024-08-15 + +- Add option to retrieve comments on issues From f019dd5d447855ffbc7786981c539d4bcc790762 Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Thu, 15 Aug 2024 20:38:33 +0700 Subject: [PATCH 6/7] Updating makefile --- Makefile | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 117c051..8dc5ab5 100644 --- a/Makefile +++ b/Makefile @@ -5,43 +5,58 @@ archive_file_name="dss-plugin-${plugin_id}-${plugin_version}.zip" remote_url=`git config --get remote.origin.url` last_commit_id=`git rev-parse HEAD` +.DEFAULT_GOAL := plugin -plugin: +plugin: dist-clean @echo "[START] Archiving plugin to dist/ folder..." @cat plugin.json | json_pp > /dev/null - @rm -rf dist @mkdir dist @echo "{\"remote_url\":\"${remote_url}\",\"last_commit_id\":\"${last_commit_id}\"}" > release_info.json @git archive -v -9 --format zip -o dist/${archive_file_name} HEAD + @if [[ -d tests ]]; then \ + zip --delete dist/${archive_file_name} "tests/*"; \ + fi @zip -u dist/${archive_file_name} release_info.json @rm release_info.json @echo "[SUCCESS] Archiving plugin to dist/ folder: Done!" +dev: dist-clean + @echo "[START] Archiving plugin to dist/ folder... (dev mode)" + @cat plugin.json | json_pp > /dev/null + @mkdir dist + @zip -v -9 dist/${archive_file_name} -r . --exclude "tests/*" "env/*" ".git/*" ".pytest_cache/*" ".idea/*" "dist/*" + @echo "[SUCCESS] Archiving plugin to dist/ folder: Done!" + unit-tests: - @echo "[START] Running unit tests..." + @echo "Running unit tests..." @( \ - PYTHON_VERSION=`python3 -V 2>&1 | sed 's/[^0-9]*//g' | cut -c 1,2`; \ - PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print(str($$PYTHON_VERSION) in [x[-2:] for x in json.load(sys.stdin)['acceptedPythonInterpreters']]);"`; \ - if [ ! $$PYTHON_VERSION_IS_CORRECT ]; then echo "Python version $$PYTHON_VERSION is not in acceptedPythonInterpreters"; exit 1; fi; \ + PYTHON_VERSION=`python3 -c "import sys; print('PYTHON{}{}'.format(sys.version_info.major, sys.version_info.minor))"`; \ + PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print('$$PYTHON_VERSION' in json.load(sys.stdin)['acceptedPythonInterpreters']);"`; \ + if [ $$PYTHON_VERSION_IS_CORRECT == "False" ]; then echo "Python version $$PYTHON_VERSION is not in acceptedPythonInterpreters"; exit 1; else echo "Python version $$PYTHON_VERSION is in acceptedPythonInterpreters"; fi; \ ) @( \ + rm -rf ./env/; \ python3 -m venv env/; \ source env/bin/activate; \ - pip3 install --upgrade pip; \ - pip install --no-cache-dir -r tests/python/requirements.txt; \ + pip install --upgrade pip;\ + pip install --no-cache-dir -r tests/python/unit/requirements.txt; \ pip install --no-cache-dir -r code-env/python/spec/requirements.txt; \ export PYTHONPATH="$(PYTHONPATH):$(PWD)/python-lib"; \ - pytest -o junit_family=xunit2 --junitxml=unit.xml tests/python/unit || true; \ - deactivate; \ + python3 -m pytest tests/python/unit --alluredir=tests/allure_report || ret=$$?; exit $$ret \ ) - @echo "[SUCCESS] Running unit tests: Done!" integration-tests: - @echo "[START] Running integration tests..." - # TODO add integration tests - @echo "[SUCCESS] Running integration tests: Done!" + @echo "Running integration tests..." + @( \ + rm -rf ./env/; \ + python3 -m venv env/; \ + source env/bin/activate; \ + pip3 install --upgrade pip;\ + pip install --no-cache-dir -r tests/python/integration/requirements.txt; \ + python3 -m pytest tests/python/integration --alluredir=tests/allure_report || ret=$$?; exit $$ret \ + ) tests: unit-tests integration-tests dist-clean: - rm -rf dist + rm -rf dist \ No newline at end of file From 7ead09f857eac6d1ac75a10ba2ddb628eb126bca Mon Sep 17 00:00:00 2001 From: Mayeul Rousselet Date: Mon, 2 Sep 2024 09:39:08 +0200 Subject: [PATCH 7/7] Added support level + link to SC + remove author [sc-199221] --- plugin.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin.json b/plugin.json index 5afc5f7..86339d8 100644 --- a/plugin.json +++ b/plugin.json @@ -4,10 +4,11 @@ "meta": { "label": "Jira", "description": "Import data from your Jira account", - "author": "Dataiku (Alex Bourret)", + "author": "Dataiku", "icon": "icon-ticket", "tags": ["Connector", "CRM"], "url": "https://www.dataiku.com/product/plugins/jira/", - "licenseInfo": "Apache Software License" + "licenseInfo": "Apache Software License", + "supportLevel": "NOT_SUPPORTED" } }