这是目前我们的自动化部署系统要作的,所以先实现吧。
1
2
3
4
5
6
7
8
9
10
11
12
|
>>>
from
jira
import
JIRA
>>> authed_jira
=
JIRA(server
=
(
'http://jira.internet.com.cn:8080/'
), basic_auth
=
(
'chengang'
,
'xxxxxxx'
))
>>> issue
=
authed_jira.issue(
'SISOMM-1315'
)
>>> jira.add_comment(issue,
'PRISM 234234ND uat chengang test'
)
>>> transitions
=
authed_jira.transitions(issue)
>>>
print
transitions
>>>
print
[(t[
'id'
], t[
'name'
])
for
t
in
transitions]
[(u
'11'
, u
'\u9700\u6c42\u7f16\u5199\u5b8c\u6210'
)]
# Resolve the issue and assign it to 'pm_user' in one step
>>> jira.transition_issue(issue,
'5'
, assignee
=
{
'name'
:
'pm_user'
}, resolution
=
{
'id'
:
'3'
})
# The above line is equivalent to:
>>> jira.transition_issue(issue,
'5'
, fields: {
'assignee'
:{
'name'
:
'pm_user'
},
'resolution'
:{
'id'
:
'3'
}})
|