Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Run custom pipeline with specific tag


Hello Community,

my scenario is as follows: 

1) I would like to run a pipeline on a user specified tag. 

I've set up a custom pipeline with an input variable, requiring to enter a tag version (TAG_VERSION) to run the build on.

As far as I can see, the pipeline initially checkouts out the full branch, so therefore I added a this line as a step:

- git fetch --all --tags && git checkout $TAG_VERSION -b $TAG_VERSION


This seems to be superfluous, if I could initially set the pipeline's checkout command to perform the checkout only on TAG_VERSION.

2) Is it possible to provide a Dropdown "Run Pipeline" (instead of a plain text field) in the input field showing all available tags ?  


Thank you for your support!

1 answer

0 votes

Hi Andreas,

Custom builds run on a detached head. They do not run on a specific branch, therefore there will be no checkout to any branch. If you need to create and checkout to a branch, you'll need to use a command like the one you posted here.

The variables used in custom builds allow the user to give any input, I'm afraid that it is not possible to specify a dropdown for a variable with all available tags, or any user defined values. If you'd be interested in that, you are more than welcome to open a feature request for this in our issue tracker for our product managers to take into account, or I can open it also for you, just let me know!

Kind regards,

Hello Theodora,

thank you for your message.

As for Question 1:

In order to ensure my custom build to run on the correct branch (master), should I actually have to put the command in front of 

- git checkout master && git fetch --all --tags && git checkout $TAG_VERSION -b $TAG_VERSION

As far as I understand "Detached Head", it's checked out on a commit...

And for Question 2, yes please open a feature request for this, thank you!


Kind regards,


Hi Andreas,

Since custom builds will run on a specific commit, they will not be associated with a branch. What I mean by that is that if you go the Pipelines page of the repo, and select the master branch, you will not see any custom builds that were run on commits of master.

The command you included in your reply first checks out master branch but then creates and checks out a new branch. Whether you need to checkout/create a branch depends on what operations you do during your build and whether you need those branches. Do you need both master and a new branch on the tag during your build?

If you don't need these branches and you want to run a custom build on a tag, you can search for the commit with this tag in the Commits page of the repo and run the custom build on this commit. Then the checkout happens on the commit with this tag.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,441 views 4 7
Read article

Community Events

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

Events near you