we use smart commits to tag the commit with the jira issue key. jira correctly identifies which commits are associated with which issues.
When a pull request is created for the branch containing those commits JIRA displays it (sometimes)
So my question is. Given two issues, both with commits known by jira, and both with an open PR, why does jira know about one PR but not the other?
what variables affect JIRA's ability to associate the PR with the issue? As it does for some and not others.
This causes warnings in the jira release section for done issues, saying they have not been approved in a PR
My goal is to have JIRA correctly identify the PR's associated with each issue.
So I opened a support ticket with Atlassian
The official documentation at the time reads like this:
|Pull requests||GitHub||Do at least one of the following:|
However the first point about including a commit in the PR that has the issue key in the commit message no longer works. They suggested it was intentionally removed and apologized for failing to update the documentation.
For anyone else searching this however I would like to point out that the 2nd option is the easiest to make work. All you need to do is put the JIRA issue key in the PR title.
The 3rd one I have not tried, as Jira does not allow you to create a github branch, only a bitbucket branch, so I can only guess that the branch only shows up if you put the issue key in the branch name which I have not tried. It also seems to sometimes show up after you create a PR with the issue key in the PR title, however by then it is not much help.
It's a tough question to answer without looking at a case where it has "failed." In my experience, this doesn't randomly fail.
Here's how things work. First, you need to associate the commit to a Jira issue. As you mention, this is done via inserting the Jira issue# (and the exact issue#) in the commit message when the commit is made. You can also add hashtag commands that can do things like add a comment in Jira, transition the workflow, etc. These actions are called Smart Commits (example when you use the BigBrassBand app.) Simply adding a Jira issue number to a commit is not "smart commit," though.
If your Jira instance is configured to be able to create a branch from within Jira, any commits done to that branch will automagically be connected to the Jira issue without needing to include the Jira issue# every time you commit.
The confusion most often comes in cases where people either don't enter a valid issue#, or they think they don't need to add an issue# because they think they are working on a branch that was created from Jira. You need to be sure to include the correct syntax. For example, "#JRA-123" is not the same as "JRA-123."
The integration is dead simple. Jira scrapes the commit messages looking for a valid issue#. Those are always in the format of "KEY-<number>" If people don't include a valid issue#, the association doesn't happen. My guess would be that the ones that fail have some syntactic error or the pull request isn't on the branch that the commit was done on. This has been the most commit cause that I have seen.
Thank you for your reply.
We are not at this time creating branches via JIRA (maybe we should). So that is not the issue.
The key syntax in the commit messages are correct, else JIRA would not be showing the commits associated with the issues. So that is not the issue.
The only other thing you said that seems to stand out to me is this:
> or the pull request isn't on the branch that the commit was done on
I would have to go back and check to confirm on these issues but this is possible. Suppose we have one person with several related issues spread over a given sprint.
They my have a general branch for the related topic and create branches from it for each single issue. As those are completed they may be merged into the general branch and then from the general branch create a PR into the develop branch. As a result the commits would be associated with the jira issues, but the PR would not?
as a rule we only require a PR when merging your code into someone elses branch or a shared branch..
I would have a look at where the merge is occurring and see if there are commits on that branch that have a valid Jira issue# in a commit message. If you can identify a case where there was a) a completed pull request and b) at least one commit on the merging branch with a valid issue# in its commit message, then you can confirm that you have a bug. If the branch being merged doesn't have a commit with a valid Jira issue# in a commit message, then I wouldn't expect to see the pull request info show up on the Jira issue.
I hope that helps.
Okay, I'm no longer looking at other peoples tasks, commits, branches and PR's .. I just setup a test myself and reproduced the issue
on github I created a PR of todd/fake-branch into some other random branch and titled it 'foo bar'
I check Jira issue CEMS-1324 in jira and I can see the commit, but no PR .. also I have a trigger on PR to transition it to awaiting review .. which happens when jira knows about the PR but .. sometimes Jira just does not seem to know about the PR, yet it knows about the commit and there has been no merge of any kind?
So this has progressed from always working, to sometimes failing, to hit and miss, to now, almost always failing.
JIRA sees commits, but not PR's
some months ago I was getting warning messages about having to change how jira and github are linked by a deadline .. if I recall I missed the deadline by a week or so but then I did change it .. I wonder if that has something to do with this.
Learn how to use two new reports for next-gen projects in Jira Cloud: Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events