Query Jira for Issues with Stash Pull Request

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!

7 answers

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

 

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

@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?

@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.

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

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.

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.

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?

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.

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

Thank you @Matthew Watson

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

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

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.

@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?

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.

 

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.

Have you found a solution for excluding Declined PRs?

Nope. Still nothing. Sorry.

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).

Were you able to figure this out?

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.

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.)

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,772 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot