JIRA:如何仅在工作流程的单个过渡中触发Webhook? [英] JIRA: How to make a webhook fire for only a single transition, of a workflow?

查看:963
本文介绍了JIRA:如何仅在工作流程的单个过渡中触发Webhook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景是:

Git-> JIRA-> Jenkins

Git -> JIRA -> Jenkins

Git中的提交必须更改JIRA中的问题状态,这反过来又应该触发Jenkins中的工作构建.

A commit in Git, must change an issue status in JIRA, which in turn, should trigger a build for a job in Jenkins.

尝试过的方法:

  1. 我在JIRA中创建了一个WebHook.此Webhook包含Jenkins作业的URL.
  2. 将此WebHook作为发布功能附加到JIRA中的工作流程.
  3. 工作流程很简单.它说:[InReview]-> [InProgress]-(Aprrove)-> [Done]
  4. webhook附加了从[进行中]到[完成]的过渡
  5. WebHook中提到了
  6. IssueKey和Issue-Updated. IssueKey将使WebHook仅适用于特定问题. Issue-Updated是在更新特定问题时将触发WebHook的事件.
  1. I created a WebHook in JIRA. This webhook contains the URL for a Jenkins job.
  2. Attached this WebHook to a Work Flow in JIRA, as a post function.
  3. The workflow is a simple one. It says: [InReview]-->[InProgress]-(Aprrove)->[Done]
  4. The webhook is attached to the transition from [InProgress] to [Done]
  5. IssueKey and Issue-Updated has been mentioned in the WebHook. IssueKey will make that WebHook work only for a specific issue. Issue-Updated is an event that will fire WebHook, when that specific issue is updated.

现在,当我执行Git提交时,Jira问题的状态将从InReview更改为InProgress,并显示一个批准按钮.当我签入Jenkins时,由于此问题的更改而触发了构建.我再次回到JIRA,单击批准"按钮,发布"状态从进行中"更改为完成",这也触发了Jenkins的构建.

Now, when I do a Git commit, status of Jira issue changes from InReview to InProgress and an Approve button appears. When I check in Jenkins, a build is triggered because of this issue change. Again I'll go back to JIRA, hit the Approve button, Issue status changes from InProgress to Done and this too triggers a build in Jenkins.

我的要求是,仅在InProgress to Done状态更改时才发生Jenkins构建.我无法指出为什么从InReview到InProgress过渡会触发Jenkins构建的原因.

My requirement is that the Jenkins build should happen only on InProgress to Done status change. I am not able to point out the reason that why the InReview to InProgress transition triggers a Jenkins build.

任何对此的指点都会有很大帮助.预先感谢.

Any pointers on this would be of great help. Thanks in advance.

推荐答案

经过多次尝试和试验,终于 JQL 为我完成了窍门.我对WebHook进行了如下

After a lot of hit and trials, finally JQL did the trick for me. I edited the WebHook as follows:

事件(与问题相关的事件)部分中,((事件和工作日志的事件.您可以指定一个JQL查询以仅发送由匹配问题触发的事件.)),我输入:

In the Events (Issue related events) section, which says (Events for issues and worklogs. You can specify a JQL query to send only events triggered by matching issues.), I entered:

issuekey = "Issue-ID" AND status = "In Review"

"Issue-ID"仅供参考.实际上,它是一个3字母的单词,后跟发行号,例如: ABC-1

"Issue-ID" mentioned in above line of code is for reference. In actual, its a 3 lettered word followed by the issue number, like : ABC-1

这将触发从特定状态转换的动作(webhook).这个故事的寓意是:所有来自JQL查询status="this value"中的"this value"的过渡都将触发webhook.

This will trigger the action(webhook) for a transition from a particular status. The moral of the story is: All transitions which source from "this value" in JQL query status="this value", will fire the webhook.

为了使Webhook更具特定于过渡的功能,以使其仅触发一个过渡,我们可以将JQL用作:

Edit 1: To make the webhook more transition specific, so that it fires for one and only one transition, we can use the JQL as:

status CHANGED FROM "In Progress" TO "Open"

这篇关于JIRA:如何仅在工作流程的单个过渡中触发Webhook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆