Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Creating Bitbucket pull requests doesn't always build in Bamboo

Joel Millage June 5, 2018

We are using Bamboo 6.4.1 and Bitbucket 5.9 we have bamboo setup to auto-build when Pull requests are made into our development branch.  This works great most of the time, but sometimes it will not run the build.   Sometimes opening/closing the pull request will trigger the build but other times it won't no matter what we do.

We aren't sure why this is happening or what is going on but it is extremely annoying.  Is there something I can look at it in the logs etc. to dig into why this is happening?  Thanks!

1 answer

0 votes
Gabriel Ribeiro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 2018

Hi Joel,

I'll list below the expected behavior so you can check in Bamboo logs what exactly is happening:

If the Branch the branch doesn't exist in Bamboo and the branch detection is set to only create the branch plan only when a pull request is created.

  • When a new branch is created, bitbucket will call the "stash-pullrequest-opened-remote-event" endpoint:
2018-06-07 15:50:05,391 INFO [http-nio-8085-exec-25] [AccessLogFilter] 172.18.0.4 POST http://bamboo:8085/rest/remote-event-consumer/latest/events/stash-pullrequest-opened-remote-event 577869kb
  •  The new branch will be created in Bamboo:
2018-06-07 15:50:05,414 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [PullRequestAwareEventListener] Received pull request opened event [ proj-plan, from: refs/heads/PullRequest-test, to: refs/heads/master]
2018-06-07 15:50:06,201 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [ImmutablePlanCacheServiceImpl] Invalidating, plan is not in cache or is being loaded: PROJ-PULL0
2018-06-07 15:50:06,208 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [PlanCreationTemplate] Creating plan with key: PROJ-PULL0
2018-06-07 15:50:06,299 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [PlanCreationTemplate] Saving repositories
2018-06-07 15:50:06,323 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [PlanCreationTemplate] Repository definitions saved
2018-06-07 15:50:06,325 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [PlanCreationTemplate] Saving plan repositories
2018-06-07 15:50:06,349 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [PlanCreationTemplate] Plan repositories saved
2018-06-07 15:50:07,028 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [PlanCreationTemplate] New Plan created with key PROJ-PULL0
2018-06-07 15:50:07,028 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-5] [BranchDetectionServiceImpl] Created branch with key PROJ-PULL0 for VCS branch VCS Branch [PullRequest-test]
  • The first build for the plan branch will be dispatched:
2018-06-07 15:50:07,321 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-12] [InitialBuildListener] Initial build for PROJ-PULL0
2018-06-07 15:50:09,231 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-7] [ImmutablePlanCacheServiceImpl] Invalidating PROJ-PULL0
2018-06-07 15:50:10,460 INFO [6-DelayedChangeDetectionThread:pool-12-thread-5] [ChainExecutionManagerImpl] Build PROJ-PULL0-JOB1-1 has been dispatched
2018-06-07 15:50:10,493 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-8] [BuildQueueManagerImpl] Attempting to queue PROJECT - Pull request test - PullRequest-test - Default Job #1 (PROJ-PULL0-JOB1-1).
2018-06-07 15:50:10,494 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-8] [ExecutionPhaseServiceImpl] PROJECT - Pull request test - PullRequest-test - Default Job #1 (PROJ-PULL0-JOB1-1) queued
2018-06-07 15:50:10,524 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-2] [BitbucketServerBuildStatusUpdater] Sending build notification to Stash (build key: PROJ-PULL0-1, repository: PROJ-PLAN)
2018-06-07 15:50:10,566 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-8] [BuildQueueManagerImpl] Sent ExecutableQueueUpdate: addToQueue, agents known to be affected: []
2018-06-07 15:50:10,567 INFO [18-BAM::Default Agent::Agent:pool-32-thread-1] [BuildAgentControllerImpl] Agent 196609 checking build queue for executables...
2018-06-07 15:50:10,585 INFO [18-BAM::Default Agent::Agent:pool-32-thread-1] [BuildQueueManagerImpl] Sending PROJ-PULL0-JOB1-1 to agent 196609 
  • When the branch is merged, bitbucket will the "stash-pullrequest-merged-remote-event" endpoint:
2018-06-07 16:03:56,398 INFO [http-nio-8085-exec-18] [AccessLogFilter] 172.18.0.4 POST http://bamboo:8085/rest/remote-event-consumer/latest/events/stash-pullrequest-merged-remote-event 468793kb 
  • The branch will be flagged as disabled:
2018-06-07 17:42:13,925 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-10] [PullRequestAwareEventListener] Received pull request merged event [ proj-plan, from: refs/heads/feature/PullRequest-test1, to: refs/heads/master]
2018-06-07 17:42:14,315 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-2] [ImmutablePlanCacheServiceImpl] Invalidating PROJ-PULL1
2018-06-07 17:42:15,682 WARN [10-BAM::PlanExec:pool-16-thread-2] [CacheAwareness] Inheriting disabledCaches:[com.atlassian.bamboo.CHANGE_DETECTION]
  •  The change will be detected and a build for the "master" branch will be dispatched:
2018-06-07 17:42:16,458 INFO [10-BAM::PlanExec:pool-16-thread-2] [ChangeDetectionListenerAction] : Change detection found 2 changes for plan PROJ-PULL
2018-06-07 17:42:16,714 INFO [10-BAM::PlanExec:pool-16-thread-2] [ChainExecutionManagerImpl] Build PROJ-PULL-JOB1-2 has been dispatched

 

Could you please analyze the logs and let us know which of these events are not being executed? 

If the changes are not being detected, could you please double check if you're not using the same repository URL with a different "repository type" (e.g. Git)? There is a possibility that a second repo is updating the Git cache before the merge and that can cause Bamboo to "think" no changes were made.

 

thanks

אופיר שמש May 22, 2019

Hey I have the same problem and sometimes it only logs the first message and sometimes it continues to the other actions. Can you maybe help me ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events