如何使用 python 和 JIRA 模块单击 Jira 票证上的按钮
How to click a button on a Jira ticket using python and the JIRA module
我们有一个更新 jira 票证的流程,我已使用以下代码自动化并使用 python 6.4 中的 JIRA 包。效果很好......但是他们在流程中添加了一个新步骤,需要我单击 'Approval' 按钮才能使 'customfield_12410' 出现在单独的弹出窗口 window 中加载其他要更新的字段。
from jira.client import JIRA
jira_server = "http://jiraserver"
jira_password = f.read()
jira_user = getpass.getuser()
jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
comment = "Test Results. Passes {0} Failed {1}".format(passed,failed)
# Get ticket information
jira_issue = jira.issue(ticketId)
jira_issue.update(fields={'customfield_12410': comment})
此代码现在生成的错误是:
text: Field 'customfield_12410' cannot be set. It is not on the appropriate
screen, or unknown.
如何单击 Jira 票证上的按钮。通过打印票证的原始内容,我没有看到任何类似于按钮名称的内容。
print(jira_issue.raw)
谢谢,
约翰.
该按钮可能是工作流转换。您可以使用 REST API 更改状态,示例位于 https://community.atlassian.com/t5/Jira-questions/JIRA-How-to-change-issue-status-via-rest/qaq-p/528133 and https://jira.readthedocs.io/en/master/examples.html#transitions
通过以下代码解决
from jira.client import JIRA
jira_server = "http://jiraserver"
jira_password = f.read()
jira_user = getpass.getuser()
jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
comment = "Test Results. Passes {0} Failed {1}".format(passed,failed)
# Get ticket information
jira_issue = jira.issue(ticketId)
transitions = jira.transitions(jira_issue)
for t in transitions:
print(t['id'], t['name'])
Output:
12 Approval
14 Cancel
# Resolve the issue with the comment
jira.transition_issue(jira_issue, '12', fields={'customfield_12410': comment})
我们有一个更新 jira 票证的流程,我已使用以下代码自动化并使用 python 6.4 中的 JIRA 包。效果很好......但是他们在流程中添加了一个新步骤,需要我单击 'Approval' 按钮才能使 'customfield_12410' 出现在单独的弹出窗口 window 中加载其他要更新的字段。
from jira.client import JIRA
jira_server = "http://jiraserver"
jira_password = f.read()
jira_user = getpass.getuser()
jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
comment = "Test Results. Passes {0} Failed {1}".format(passed,failed)
# Get ticket information
jira_issue = jira.issue(ticketId)
jira_issue.update(fields={'customfield_12410': comment})
此代码现在生成的错误是:
text: Field 'customfield_12410' cannot be set. It is not on the appropriate
screen, or unknown.
如何单击 Jira 票证上的按钮。通过打印票证的原始内容,我没有看到任何类似于按钮名称的内容。
print(jira_issue.raw)
谢谢,
约翰.
该按钮可能是工作流转换。您可以使用 REST API 更改状态,示例位于 https://community.atlassian.com/t5/Jira-questions/JIRA-How-to-change-issue-status-via-rest/qaq-p/528133 and https://jira.readthedocs.io/en/master/examples.html#transitions
通过以下代码解决
from jira.client import JIRA
jira_server = "http://jiraserver"
jira_password = f.read()
jira_user = getpass.getuser()
jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
comment = "Test Results. Passes {0} Failed {1}".format(passed,failed)
# Get ticket information
jira_issue = jira.issue(ticketId)
transitions = jira.transitions(jira_issue)
for t in transitions:
print(t['id'], t['name'])
Output:
12 Approval
14 Cancel
# Resolve the issue with the comment
jira.transition_issue(jira_issue, '12', fields={'customfield_12410': comment})