jira: Unable to add issues to epic after update 3.0.1 -> 3.1.1

Bug summary

Exception when trying to add issues to an epic:

  File "/home/valentijn/dd/dojo/jira_link/helper.py", line 580, in add_jira_issue_for_finding
    return add_jira_issue(finding, *args, **kwargs)
  File "/home/valentijn/dd/dojo/jira_link/helper.py", line 695, in add_jira_issue
    add_issues_to_epic(jira, obj, epic_id=epic.jira_id, issue_keys=[str(new_issue.id)], ignore_epics=True)
  File "/home/valentijn/dd/dojo/jira_link/helper.py", line 565, in add_issues_to_epic
    return jira.add_issues_to_epic(epic_id=epic_id, issue_keys=issue_keys, ignore_epics=ignore_epics)
  File "/home/valentijn/venv/lib/python3.8/site-packages/jira/client.py", line 4768, in add_issues_to_epic
    raise NotImplementedError(
NotImplementedError: Jira Agile Public API does not support this request

Used to work in 3.0.1 and I think this a supported operation. Could it have to do something with the changes made in https://github.com/pycontribs/jira/pull/1186 ?

There’s some code referring to the old value of agile_rest_path it seems?

if (
            self._options["agile_rest_path"]
            != GreenHopperResource.GREENHOPPER_REST_PATH
        ):
            # TODO(ssbarnea): simulate functionality using issue.update()?
            raise NotImplementedError(
                "Jira Agile Public API does not support this request"
            )

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Cloud (Hosted by Atlassian) and JIRA Server

Jira instance version

8.20.1

jira-python version

3.1.1

Python Interpreter version

3.8

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

Call `add_issues_to_epic`

Stack trace

see above

Expected behaviour

Issues being added to epic

Additional Context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

FWIW we already subclass jira.JIRA in order to add some other helper methods and the like, so we’ve solved this by overriding the method as follows:

class JiraService(JIRA):
    def __init__(self):
        super().__init__()

    def add_issues_to_epic(self, epic_key, issue_keys):
        data = {"issues": issue_keys}
        url = self._get_url(f"epic/{epic_key}/issue", base=self.AGILE_BASE_URL)
        response = self._session.post(url, data=json.dumps(data))
        return response

(note: lots of additional code related to auth and logging removed for clarity’s sake in this example.)

That’s correct

Can confirm that add_issues_to_epic works in 3.0.1 but is not working in 3.1.1. Manually this endpoint seems to working fine: https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-agile-1-0-epic-epicidorkey-issue-get