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!
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 https://jira.atlassian.com/secure/Dashboard.jspa for our product managers to take into account, or I can open it also for you, just let me know!
Kind regards,
Theodora
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,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Theodora Boudale , I came across this thread as we are searching for an answer on this too.
You mentioned following in your reply dated on Oct 05, 2020:
"The variables used in custom builds allow the user to give any input"
Does that mean bitbucket pipeline is able to ask for user input amid a pipeline run? If so, can you show me an example or any documentation about this please? Many thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @binjie zhao,
If you use Pipelines with the keyword custom, you can define variables that you provide when you trigger the build (not in the middle of the build, but when you trigger the build manually). You can check the documentation below:
You can also check the screenshot on the following page (the image before the section "On schedule":
Please note that custom pipelines do not run automatically. You can trigger them manually from our website, via API, or as a scheduled pipeline.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.