简体   繁体   English

从Jenkins 2管道更新Jira票证

[英]Updating Jira ticket from jenkins 2 pipeline

Hi I am implementing a jenkins 2 pipeline. 嗨,我正在实现詹金斯2管道。 I am trying to create a groovy function that will update a given story in Jira. 我正在尝试创建一个常规功能来更新Jira中的给定故事。 I found the below code which I have been told should work. 我发现下面的代码可以正常工作。

step([$class: 'hudson.plugins.jira.JiraIssueUpdater', 
issueSelector: [$class: 'hudson.plugins.jira.selector.DefaultIssueSelector'], 
scm: [$class: 'GitSCM', branches: [[name: '*/master']], 
    userRemoteConfigs: [[url: 'https://github.com/jglick/simple-maven-project-with-tests.git']]]])

I am wondering how is the ticket specified using this? 我想知道如何使用此指定票证? Would anyone be able to describe what is happening in this code? 谁能描述这段代码中发生的事情?

I have never used Jira pipeline-compatible plugin but from the plugin's pipeline documentation it appears that you can pass a number of parameters to Jira's updater such as : 我从未使用过与Jira管道兼容的插件,但是从该插件的管道文档中,您似乎可以将许多参数传递给Jira's updater例如:

  • Jira REST base url Jira REST基本URL
  • Jira Username/Password Jira用户名/密码
  • JQL for selecting issues to be updated JQL,用于选择要更新的问题
  • Jira comment to be added 吉拉评论将被添加

I think a close look to this documentation file will give you all the information you need, and once you know which parameters you should be able to call Jira updater with this kind of Groovy code : 我认为,仔细阅读此文档文件将为您提供所需的所有信息,一旦您知道了哪些参数,便可以使用这种Groovy代码调用Jira updater

step([$class: 'hudson.plugins.jira.JiraIssueUpdater',
  restAPIUrl: yourJiraAPIUrl,
  jql: theJQLQueryThatWillFindYourIssuesToUpdate,
  comment: theComment,
  failIfJqlFails: true
)

The sample you provide does not seem to be correct because the two parameters issueSelector and scm are not valid parameters of the JiraIssueUpdater class. 您提供的示例似乎不正确,因为两个参数issueSelectorscm 不是 JiraIssueUpdater类的有效参数。

See this link for some sample, like : 请参阅此链接以获取一些示例,例如:

JiraIssueUpdateBuilder usage example JiraIssueUpdateBuilder用法示例

node {
    step([$class: 'hudson.plugins.jira.JiraIssueUpdateBuilder', 
        jqlSearch: "project = EX and labels = 'jenkins' and labels = '${version}'",
        workflowActionName: 'Resolve Issue',
        comment: 'comment'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM