You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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>`.
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.
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
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.