我正在尝试使用Jenkins文件在Jira中创建一个问题,代码如下:
echo "Connecting with jira"
withEnv(['JIRA_SITE=******']) {
def testIssue = [fields: [ project: [id: 10000],
summary: "New JIRA Created from Jenkins.",
description: "New JIRA Created from Jenkins.",
issuetype: [id: 3]]]
response = jiraNewIssue issue: testIssue
echo response.successful.toString()
echo response.data.toString()
但是在连接到Jira时,它显示错误:
Connecting with jira
[Pipeline] withEnv
[Pipeline] {
[Pipeline] jiraNewIssue
JIRA: Site - ****** - Creating new issue:
IssueInput(fields=FieldsInput(summary=New JIRA Created from Jenkins.,
description=New JIRA Created from Jenkins., issuetype=IssueType(id=3,
description=null, name=null, subtask=null), project=Project(id=10000,
key=null, name=null, description=null, lead=null, components=null,
versions=null, issueTypes=null, projectCategory=null), labels=null,
assignee=null, components=null, fixVersions=null))
Error Code: 400
Error Message: {"errorMessages":[],"errors":{"customfield_10200":"QA
Owner is required."}}
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
**ERROR: {"errorMessages":[],"errors":{"customfield_10200":"QA Owner is
required."}}**
Finished: FAILURE
任何人都可以告诉我应该在哪里添加该自定义字段" QA所有者"。
答案 0 :(得分:0)
这将通过传递自定义字段 - QA所有者
来工作echo "Connecting with jira"
withEnv(['JIRA_SITE=******']) {
def testIssue = [fields: [ project: [id: 10000],
summary: "New JIRA Created from Jenkins.",
description: "New JIRA Created from Jenkins.",
issuetype: [id: 3],
"customfield_10200": { "name": "ABC" }
]]
response = jiraNewIssue issue: testIssue
echo response.successful.toString()
echo response.data.toString()
其中abc是QA所有者的Jira ID。