We've recently been rolling out Bitbucket Pipelines for our builds. That's all going pretty well now (after some heavy scripting...) and on the Bitbucket side of things, builds are showing up properly attached to PRs, and then we've got branches set up for our test environments (etc) to merge onto, which will automatically deploy to the correct environment.
The issue we're hitting at the moment is getting Jira to reliably update with deployment information. On the Bitbucket side, when we run a test deployment, that deployment seems to correctly pick up the issues that should be attached to it:

But in Jira, the deployment only seems to attach to one ticket (possibly because it's the one labelled in the merge commit onto the test branch?

This is also reflected when viewing the individual issues - in this example, for NN-2223, there's a Release section in the sidebar , but NN-2296 has no such entry.
What controls how cases get attached in Jira? Does it ignore the information that Bitbucket has and just parse the commit messages? Is there anything we can do to work around this?