Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Is it possible to add a custom dropdown with predefined values to the screen just before merging a pull request, so I can then access the value selected by user from within the pipeline launched by the merge?
I want be able to tell the pipeline, if the merge is `major | minor | patch | prerelease | alpha` type and then adjust the new version of the package accordingly using `yarn version --<value>`.
Hi Jan,
I'm afraid that this is not possible, only custom pipelines (that are triggered manually by a user) accept run-time variables. For this type of pipeline, the variables can be set by the user when the user triggers it:
If you don't mind triggering the pipeline manually, you could use a custom pipeline with a variable that you can set when you trigger the build.
Otherwise, the only other way I can think of is by changing the bitbucket-pipelines.yml file in the source branch and adjusting the version, before you merge a pull request.
Kind regards,
Theodora
Hi Theodora, when you say _trigger manually_ – how do I trigger a pipeline manually? Is that not the same as creating a pull request and then clicking merge?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jan,
There are several ways to trigger a custom pipeline manually:
1) On Bitbucket Cloud website, go to the Pipelines page of the repo. On this page, where all the pipelines builds are listed, you will see an option Run pipeline at the top of the page (next to the Schedules option):
If you select the Run pipeline option you will see the following dialog where you can select a branch and one of the pipelines available for this branch. If you select a custom pipeline with variables, you'll be able to select a value for the variables:
2) If you go to the Branches page of the repo, and select the 3 dots under Actions for a branch, you will see the option Run pipeline for a branch:
3) If you open a commit (from the Commits page of the repo), on the right side of the page you will also see an option Run pipeline:
4) You can use our API to trigger a custom pipeline in a script on your local environment:
5) You can create a schedule to run a custom pipeline at hourly, daily, or weekly intervals. However, schedules don't provide the option to set a variable's value, so I don't think that would be a suitable option.
Is that not the same as creating a pull request and then clicking merge?
No, this is not the same. If you have in your bitbucket-pipelines.yml file a definition for
branches:
main:
this pipeline will run automatically every time you push commits to the main branch or if you merge a PR to the main branch.
Custom pipelines do not get triggered automatically when there are new commits to a branch, they need to get triggered with one of the ways I listed above.
If you have any other questions, please feel free to let me know.
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.
Thank you, that sounds promising, especially the option 4 via API. Do I imagine it correctly that this could be triggered via some other task orchestration tool like Jenkins?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome Jan, and yes, this is also possible.
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.