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

BITBUCKET_BRANCH Variable in Custom Pipelines

Scott Nickless July 24, 2022

Hi All,

 

Can anyone confirm if the BITBUCKET_BRANCH works in custom pipelines? I just tried it and it worked in the feature branch that I'm working on, but the documentation here says it's not available in Custom Pipelines. Something that may make a difference is I'm using Deployment environments in my pipelines, so not sure if that allows it to work?

 

Basically, I'm after Atlassian to say it's supported in custom pipelines, or the community to say that you use it and it works. Just looking for that reassurance before putting it into production.

I should mention that any articles I've found on this question are 4 or 5 years old, so I'm looking for a more up to date answer.

 

Thank you

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2022

Hello @Scott Nickless ,

Thank you for reaching out to Atlassian Support.

It depends on how you trigger the custom pipeline. If you trigger it from the Pipelines page > Run pipeline, where a panel will show up and you have to select the branch for which the pipeline will run, then yes, the value of $BITBUCKET_BRANCH will be available in the build.

However, if you trigger the pipelines by directly accessing a commit from the Commits page, and then clicking on Run pipeline option on the left side of the page, the build will be triggered specifically for that commit and with no reference to a branch, so $BITBUCKET_BRANCH will be empty within the build steps.

Hope that helps to clarify your questions.

Thank you, @Scott Nickless .

Kind regards,

Patrik S.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events