Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I tried to transition the jira issue to
closed
status, the code is:
jira.create_issue_link('Duplicate', issue, issueJ, None)
jira.transition_issue(issueJ.key, '181')
query.remove(issueJ)
The first sentence works, it creates a link. But the transition_issue not works and it throws and exception:
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://xxxxxxxxxxxxx.net/rest/api/2/issue/ticket.number/transitions
text: The selected resolution cannot be chosen during this action.
response headers = {'Server': 'nginx/1.10.3', 'Date': 'Wed, 20 Mar 2019 09:37:33 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'X-AREQUESTID': '577x474155x4', 'X-ASESSIONID': '1fwn7w3', 'X-ANODEID': 'prd-dops-issues-ap-02', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Security-Policy': "frame-ancestors 'self'", 'X-ASEN': 'SEN-11553968', 'X-Seraph-LoginReason': 'OK', 'X-AUSERNAME': 'gongjunh', 'Cache-Control': 'no-cache, no-store, no-transform', 'Content-Encoding': 'gzip', 'Vary': 'User-Agent'}
response text = {"errorMessages":[],"errors":{"resolution":"The selected resolution cannot be chosen during this action."}}
I confirmed that I can transition the status of the issue on the jira page, but I am not sure why the exception occurs in the code.
–
Well in Jira, each Queue can have different configuration. In transitions, each queue defines which are the states(close, In Progress, Solved etc) can be possible from Open state.
Below is one sample configuration:
You can not mark any other state/transition which is not allowed.
There is an API available: transitions(issue_id) (in python, the one you are using)
WHich will list all the possible transitions can be done from current state. The state that you want to move in, is probably not in that list.
Try this.
–
First of all check your workflow in Jira, in my case it is like this:
So, before marking pass or fail i need to transit through other intermediate stages as well. So, e.g. if testcase or testrun is in New state. Then transition will be as below,
jira = JIRA(options="Jira_Server_URL", basic_auth=("userID", "Password"))
jira.transition_issue(issue, transition='Ready For Test')
jira.transition_issue(issue, transition='Test in Progress')
jira.transition_issue(issue, transition='Pass')
Replace Jira_Server_URL, userID, Password and transition accordingly.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.