0
votes

Basically, this is what I am trying to do: StatusChangedInKanban. And I tried the suggestion mentioned there.
I have created webhook to fire Jenkins using "jira-trigger-webhook-receiver" plugin.

The following JQL works(filters the event to kick the build in Jenkins):
project = MyProject AND type in (Bug, ...).

But NOT the following(always kicks build in Jenkins, as if "All Issues"):
status changed FROM "In Progress" TO Done. (I tried different combination of it). Seems like it doesn't even know what "changed from/to" is.

However it shows in the operator drop-down when I type in the "Issue related events" for JQL.

Looks like I am missing some configuration somewhere.
And I tried that workflow method mentioned in the above link as well. Didn't work.
What am I doing wrong?

1
1) Is the build triggering on issues that have already built? 2) Is the build triggering on issues that have gone from status-before-in-progress TO "In Progress"?HeyZiko
@HeyZiko-If I use "status = Done", the event is filtered based on this logic, which means the build is triggered if I move the issue/story from "Done" column. But if I use "status CHANGED FROM/TO", it acts as if there is no filter at all. So, it will trigger the build for everything.SUpreti
Have you checked jira-trigger-plugin's Changelog matcher option? You can add a JIRA Field Matcher for Status field, hence doing the filtering in Jenkins instead of JIRA. Check the plugin's README / help for more information.ceilfors
@ceilfors- That is what I ended up doing. I filtered by "project" and "type" in JIRA side and "Field Matcher" in the Jenkins side. Any idea how to AND multiple JIRA fields in Jenkins side?SUpreti

1 Answers

0
votes

When you do a STATUS CHANGED FROM or STATUS CHANGED TO query in JQL, it looks at the entire history of the issue, not the most recent change. Therefore, you're getting everything that ever changed from "in progress" to "done".

Since you're dependent on the webhook, you can trust that the automation kicks in every X minutes or days. Thus, your query should probably look like this:

project = MyProject AND type in (Bug, X, Y) 
AND status changed FROM "In Progress" TO Done AFTER -1d
AND status = Done 

Line by line, this is what you're telling JIRA:

For Bug, X, and Y issues in MyProject

Find everything that changed from In-Progress to Done in the past day

(you can adjust the -1d to match your automation frequency, like -5m for the past 5 minutes)

And is currently Done

(because if you have a subsequent status like Closed then you don't want it to build)