Query Jira for Issues with Stash Pull Request

JoeA May 8, 2014

Is it possible to query Jira and find all issues that have a Stash pull request associated to them? I see the pull request show up in the "Development" panel when I navigate to a story with an associatied pull request, but I can't figure out if I can actually query for them or not.

I'd like to be able to run this to help track which stories were code reviewed using a pull request. Thank you!

8 answers

9 votes
Lukasz Guzowski January 19, 2016

Found something. To sum up - you can query for:

issue.property[development].commits

issue.property[development].prs

issue.property[development].openprs

issue.property[development].reviews

issue.property[development].failingbuilds

 

With the proper combination you can get what you want - for example, merged pull requests :

issue.property[development].prs > 0 and issue.property[development].openprs = 0

etc.

 

Hope this helps. Still don't know how to query for succeded builds.

 

Lukasz Guzowski January 22, 2016

issue.property[development].prs > 0 and issue.property[development].openprs = 0

that does not represent merged pull requests unfortunately, as they can be declined, and this query will still return true. Still looking.

Fabian Ehrentraud June 8, 2016

Have you found a solution for excluding Declined PRs?

Lukasz Guzowski September 29, 2016

Nope. Still nothing. Sorry.

jwhite May 10, 2019

Vote on this feature request to fix this issue

https://jira.atlassian.com/browse/JRASERVER-60724

6 votes
Todd_Ross June 29, 2015

Try this.... issue.property[development].commits > 0 AND issue.property[development].prs > 0

 

Ari Brown July 6, 2015

Not working for me - what's the issue.property syntax?

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2015

@Todd Ross Great! It works perfect. Just wondering, why query for 'issue.property[development].commits > 0'? When you have a pull request open, you always have commits associated to your JIRA issue?

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2015

@Todd Ross And while we're add it. Could you point me to a URL with info about issue.property syntax. I'm wondering if I can also query for open pull requests.

Ari Brown July 7, 2015

@Rudy Holtkamp [TMC] - Can you make it work with just 'issue.property[development].commits > 0'?

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 7, 2015

Hi @Ari Brown No, but it works with just issue.property[development].prs > 0. Unless I'm mistaking, you always have a commit associated when you have a pull request, so no need to check for commits.

Ari Brown July 7, 2015

Thanks Rudy - From what I know from standard JQL and what I can figure out that makes sense. Unfortunately I can't get anything to return when using that syntax and I'm wondering what, if anything, it requires. We've got stash, but is the issue.property[development].commits or prs more specific than that? Does it only work with certain types of repos? What other items might return info for me? Would love to understand the syntax better.

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 8, 2015

For your info Ari, we use JIRA 6.4 and Stash 3.10. What I understood from some info I found on developers.atlassian.com is that it has been added to JIRA 6.2. Are there types of repo's? (Accept for bare and normal?) Just wondering do you see a development panel in JIRA?

Ari Brown July 8, 2015

I've got Jira 6.3.9 and Stash 3.6.0. Should be fine on Jira, unless our stash version is too old... I don't think there are any other types of repos - I'm just surprised that I'm getting nothing here.

mwatson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 16, 2015

That format of JQL is only supported in JIRA 6.4 and above. It is not a publicised feature due to the fact it has a number of caveats that impact its usability. The information in JQL is only optimistically updated assuming you have JIRA and Stash connected via Applinks correctly (see https://confluence.atlassian.com/display/STASH/Linking+Stash+with+JIRA and https://confluence.atlassian.com/display/JIRA/Integrating+JIRA+with+Stash). In certain cases, changes in Stash will not be updated in JIRA unless you manually view the issue or view it as part of release hub https://confluence.atlassian.com/display/JIRA/Checking+the+progress+of+a+version. These cases are: * When JIRA is down or unreachable * When a repository is pushed to Stash with a lot of issues mentioned in the commits Hope this helps explain things

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2015

Thank you @Matthew Watson

Karl Becker August 27, 2015

Is there a method to find merged PRs in issues? Is there more documentation on precisely what is in `issue.property[development]` ?

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 27, 2015

No if you google you get referred to this link: https://developer.atlassian.com/jiradev/jira-architecture/building-jira-add-ons/jira-entity-properties-overview#JIRAEntityPropertiesOverview-Example2:Retrievingdata which does not help me. but ssue.property[development].failingbuilds is one that works, so if you do find others (succeeding build, branches?) please drop a comment Rudy

Jay Sachdev March 10, 2017

Seems like this has changed to be:

    development[pullrequests].open > 0

Other examples based off the error responses:


Available properties are "development[pullrequests]", "development[commits]", "development[reviews]" and "development[builds]" For "development[pullrequests]" use "development[pullrequests].all" or "development[pullrequests].open"

etc.

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2017

@Jay Sachdev, which version of JIRA is that?

Because it does not work on JIRA 7.3.1, do you have some add-on installed?

Deleted user May 28, 2018

This post confirms this syntax. I've tested this out on JIRA cloud and it works.

 

Orphaned changes: development[pullrequests].all = 0 AND development[commits].all > 0

Unmerged changes: development[pullrequests].open > 0 AND development[commits].all > 0

Anton Genkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2018

For Jira Software Server you can find the full list of available development fields here - https://confluence.atlassian.com/jirasoftwareserver/advanced-searching-fields-reference-939938743.html

alexmears October 10, 2018

@Anton Genkin, your confluence link doesn't seem to be working.

Also, may you provide the exact syntax. I am unable to make it work and would appreciate an example.

Anton Genkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2018

@alexmears If you use Jira Software 7.8+ integrated with Bitbucket, then the following syntax will work:

  • Issues with PRs (any PR status): development[pullrequests].all > 0 
  • Issues with open PRs: development[pullrequests].open > 0 
  • Orphaned changes: development[pullrequests].all = 0 AND development[commits].all > 0
  • Unmerged changes: development[pullrequests].open > 0 AND development[commits].all > 0
1 vote
Mark Dermanov February 19, 2019

issue.property[development].commits

issue.property[development].prs

issue.property[development].openprs

issue.property[development].reviews

issue.property[development].failingbuilds

Jira Cloud - no one from filters do not works(

1 vote
Rudy Holtkamp May 21, 2014

When you do find out, I'm very interested in how. We can really use it for e.g. automatic transition of an issue (e.g. to review when a pull request starts).

Andrew S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 16, 2015

Automated issue transitions are described here: https://confluence.atlassian.com/display/JIRA/Configuring+workflow+triggers

0 votes
radai rosenblatt May 10, 2016

i found a relevant (i think) proposal for this - https://jira.atlassian.com/browse/BSERV-4048

it would be helpful if people interested in this voted for the issue

0 votes
Lukasz Guzowski January 18, 2016

I would also be very interested in knowing the properties that I can search for by issue.property[development].. as our main problem is to know which issues are ready for testing (have MERGED pull request).

Also I would like to know which issues will be included in the next build (example have issue.property[development].builds < 0 - unfortunately this does not work)

Generally I lack the functionality to query JIRA for properties that are stored in joined applications (stash, bamboo etc.)

Marco Matarazzo November 28, 2018

You may find this useful: fixVersion = earliestUnreleasedVersion()

0 votes
JoeA May 20, 2014

No, I was not able figure out a means to do this. I was hoping someone from Atlassian would be able to verify that for sure.

0 votes
Patrick Baker May 18, 2014

Were you able to figure this out?

Suggest an answer

Log in or Sign up to answer