[英]How to create a JIRA new Issue using the Jenkins Jira Steps Plugin
我想使用Jenkins Jira Steps Plugin創建一個新的 Jira 問題。
這是我的演示管道:
node {
stage('JIRA') {
def testIssue = [fields: [ project: [id: '1'],
summary: 'New JIRA Created from Jenkins.',
description: 'New JIRA Created from Jenkins.',
issuetype: [id: '11']]]
response = jiraNewIssue issue: testIssue, site: 'JIRA T'
echo response.successful.toString()
echo response.data.toString()
}
}
運行管道后,我得到:
[Pipeline] node
Running on master in /home/tomcat/.jenkins/workspace/Jira-RFC-Demo-Pipeline
[Pipeline] {
[Pipeline] stage
[Pipeline] { (JIRA)
[Pipeline] jiraNewIssue
JIRA: Site - JIRA T - Creating new issue: IssueInput(update=null, fields={project={id=1}, summary=New JIRA Created from Jenkins., description=New JIRA Created from Jenkins., issuetype={id=11}})
Error Code: 400
Error Message: {"errorMessages":[],"errors":{"project":"project is required"}}
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: {"errorMessages":[],"errors":{"project":"project is required"}}
Finished: FAILURE
所以看起來插件無法從 testIssue 中讀取項目。 盡管如此,這應該是創建上面鏈接中記錄的問題的方法。
有什么想法嗎?
我認為錯誤信息具有誤導性。 以下是訣竅:
node {
stage('JIRA') {
def testIssue = [fields: [ project: [key: 'RFC'],
summary: 'New JIRA Created from Jenkins.',
description: 'New JIRA Created from Jenkins.',
issuetype: [id: '10500']]]
response = jiraNewIssue issue: testIssue, site: 'JIRA T'
echo response.successful.toString()
echo response.data.toString()
}
}
不同之處在於使用密鑰而不是項目 ID。 所以也許 id 根本不存在或無效。
無論如何,我認為使用鍵更具表現力。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.