Hi Guys,
This is my first post. Hope i get a quick response.
What i have now is:-
a build plan which run unit test with every commit pushed in feature/* branch
What i need is
I want to create a plan which get executes only when PR is created and merge is blocked until build passes.
Im really stuggling to find out correct solution.
Any help is really appreciated.
Thanks
Supra
Hello Supra,
Welcome to Atlassian community.
A build plan which run unit test with every commit pushed in feature/* branch - This is the expected behaviour as you have trigger enabled on Bamboo and it will build the plan with each commit so this is expected, if you don't want to trigger this with each build then remove the trigger and probably set some other trigger like a scheduled trigger where frequency would be low.
Coming to your other question
I want to create a plan which get executes only when PR is created and merge is blocked until build passes.
Here you can use the concept of plan branches, whenever a PR is created in Bitbucket Bamboo will create a new plan branch automatically and will build it. This plan will automatically get disabled once the PR is merged successfully.
Create a plan and link it to the repository on which PR will be created and then on this plan you can enable branches as shown below, whenever a PR is created it will create a new plan branch on this plan and automatic build will start on it.
Read more about it at Using plan branches , you can use the below options from Branches tab on your plan
I am not yet sure on you ask regarding Merging, are you talking automatic Merging from Bamboo or manual PR merge in Bitbucket or any other repo
Regards,
Shashank Kumar
Thanks for ur quick reply.
my second question is the one im trying to solve it.
So just now i did a commit and added below logic in a feature/* branch. It did triggered the build which u mentioned as above as default behaviour
branches:
create: for-pull-request
In order to stop where should i go to remove the trigger, as shown below i cannot remove trigger.
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.
I was able to sort the issue now the plan branch looks as it needs to be. However, i deleted the PR and recreated a new PR didnt work, what am i missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So when you recreated the new PR, new plan branches are not created in Bamboo?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was able to figure out what needs to be changed. Ur comment helped me a lot.
However im getting this error now but i can do what i wanted. But this error annoys a bit
Error says -
Update plan's branching configuration or delete existing pull request plans to enable switching the default repository.
01-Mar-2025 23:44:59 None of the override rules matched on the current branch 'dev'. 01-Mar-2025 23:45:01 com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: Plan branch / workflow: You can't change the default repository because automatic branch management for this plan is dependent on pull request and PR plan branches exist for this build.Update plan's branching configuration or delete existing pull request plans to enable switching the default repository. 01-Mar-2025 23:45:01 java.lang.IllegalArgumentException: com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: Plan branch / workflow: You can't change the default repository because automatic branch management for this plan is dependent on pull request and PR plan branches exist for this build.Update plan's branching configuration or delete existing pull request plans to enable switching the default repository.
This is my yaml
---
version: 2
plan:
project-key: REI
name: Integration Testing
key: ITEST
stages:
- Test:
manual: false
jobs:
- Test
branch-overrides:
-
stage:
stages:
- Deploy:
manual: false
jobs:
- Deploy
Deploy:
tasks:
- script:
- echo "Deploying to dev..."
- echo "Waiting...."
- sleep 3s
- echo "Deployment Successful in Dev.!!!"
Test:
key: TEST
tasks:
- script:
- echo "Validating test.."
branches:
create: for-pull-request
delete:
after-deleted-days: 7
This is what my branch config looks like
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to know your issue is resolved!
Your error is explained at this community article > https://community.atlassian.com/t5/Bamboo-questions/Editing-Java-Specs-for-plans-with-active-PRs-requires-deletion/qaq-p/1332651
Probably you have old plan branches created with the old default repository and now you have probably linked a new default repository and because of which this error is coming.
Is this scenario valid to your instance?
Regards,
Shashank Kumar
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.