Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Version 1.1.4](https://github.com/dataiku/dss-plugin-jira/releases/tag/v1.1.4) - Bug Fix release - 2025-10-29

- Implement SSL check ignore on post requests (issue creation)
- Bubble up 4XX errors on agent tool

## [Version 1.1.3](https://github.com/dataiku/dss-plugin-jira/releases/tag/v1.1.3) - Bug Fix release - 2025-09-11

Expand Down
19 changes: 10 additions & 9 deletions python-agent-tools/create-issue/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ def get_descriptor(self, tool):
}

def create_jira_issue(self, summary: str, description: str, issue_type: str = "Task"):
try:
new_issue = self.client.create_issue(self.jira_project_key, summary, description, issue_type)
return new_issue

except Exception as exception:
return f"Error creating issue: {str(exception)}"
return self.client.create_issue(self.jira_project_key, summary, description, issue_type)

def invoke(self, input, trace):
args = input.get("input", {})
Expand All @@ -58,7 +53,7 @@ def invoke(self, input, trace):
trace.attributes["config"] = {
"jira_instance_url": jira_instance_url,
"jira_project_key": self.jira_project_key
}
}

created_issue = self.create_jira_issue(summary, description)

Expand All @@ -68,10 +63,16 @@ def invoke(self, input, trace):
)
else:
output_text = f"Issue created: {created_issue.get('key')} available at {jira_instance_url}browse/{created_issue.get('key')}" if isinstance(created_issue, dict) else created_issue

# Log outputs to trace
trace.outputs["output"] = output_text

return {
"output": output_text
}
}

def load_sample_query(self, tool):
return {
"summary": "Computer not working",
"description": "User cannot log in his computer. Please create an account"
}
45 changes: 45 additions & 0 deletions python-lib/jira_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def create_issue(self, jira_project_key, summary, description, issue_type):
# This data form does not work on v3
url = "/".join([self.get_site_url(), "rest/api/2/issue"])
response = self.post(url=url, json=json)
raise_on_response_error(response, context="Failure while creating issue")
json_response = response.json()
return json_response

Expand Down Expand Up @@ -311,3 +312,47 @@ def arrayed(data):
return data
else:
return [data]


def raise_on_response_error(response, context=""):
if not isinstance(response, requests.Response):
raise Exception("The response from server is not recognized")
status_code = response.status_code
if status_code > 299 or status_code < 200:
json_response = safe_json(response)
if json_response:
message = extract_message(json_response)
if not message:
message = response.text
else:
message = response.text
raise Exception(
"Error {}: {}: {}".format(
status_code,
context,
message
)
)


def extract_message(json_response):
paths = [
["errors", "summary"],
["errors", "issuetype"],
["errors", "description"]
]
for path in paths:
next_token = json_response
for token in path:
next_token = next_token.get(token, {})
if next_token:
return next_token
return None


def safe_json(response):
try:
reponse_content = response.json()
except Exception:
return None
return reponse_content