Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Can I capture a Bitbucket build number in a Jira issue?

We are using the Cloud products, and while I keep finding server product answers to this online, they don't immediately seem workable in the Cloud versions.

So, my use case / ask is this:  After a PR is merged and build process completes (or even if it doesn't), I'd like to get that Bitbucket build number displayed (and linked, ideally) in the corresponding Jira ticket.

I know the BB build number is available in some sense from this page (and others):

See the second row of the table:  BITBUCKET_BUILD_NUMBER

However, the custom field options I'm seeing in the Cloud version of Jira aren't obvious candidates for pulling this in, but I'm open to all options or ideas!  :D

Thanks for any suggestions!

1 answer

0 votes

Hi Erik,

The BITBUCKET_BUILD_NUMBER is a Pipelines variable and it is accessible only to the build while it is running. It cannot be used outside of the build.

We have an integration for Bitbucket Pipelines and Jira Software that allows you to see build information on a Jira issue, however, it requires that you put the issue key in the branch name:

I am quoting the example from the documentation, if you have a branch named 'feature/ST-1-build-mk2-boosters', then build information would appear in the Jira issue ST-1 every time your pipeline runs against a commit within that branch. I'm not sure if this is something that would suit your needs?

Another idea would be to have a custom field in Jira, and then update its value via an API call in the after-script of the Pipelines build. One issue here would be how to get the Jira issue key during the build, in order to update the Jira issue.

I was wondering if you could give us some more details on your use case, so we can see if there's a way to achieve what you like:

1. You mention "After a PR is merged and build process completes": how are these builds defined in the yml file? Is it builds that run automatically on a specific branch, e.g. master or develop, and they get triggered when you merge a PR to that branch? Or are they custom builds?

2. Do you use the source branch of each PR for only one Jira issue?

3. Do you have Jira issue keys references in the commits of the source branch of the PR? In the title of the PR? Or in the merge commit? And, related to the previous question, do you only reference one Jira issue in each source branch?

Kind regards,

Suggest an answer

Log in or Sign up to answer
Site Admin

Atlassian Community Events