I'm new to bamboo and webhooks. I'm trying to start a bamboo build automatically when a PR to master branch from my repo is opened.
I followed this guide but the remote trigger is not starting at all.
Bamboo:
BitBucket:
I've already checked the following:
- verify that the whitelisted ip is correct (the bitbucket webhook fails if i remove that)
- my bamboo plan is enabled and is building fine on manual run
Bamboo plan in YAML:
---
oid: 7818389690603565060
key: XT
name: XXX - TEMP
project:
oid: 7819374853022025730
key: DIGQA
repositories:
- oid: 7818811903068661169
parentRepository: 7818811903068661168
triggers:
- name: Bitbucket Server repository triggered
description: ''
pluginKey: com.atlassian.bamboo.plugins.stash.atlassian-bamboo-plugin-stash:stashTrigger
enabled: true
configuration: {}
triggerConditions:
com.atlassian.bamboo.triggercondition.internal:plansGreenCondition:
enabled: 'false'
triggeringRepositories:
- 7818811903068661169
- name: Remote trigger
description: Master PR Trigger
pluginKey: com.atlassian.bamboo.triggers.atlassian-bamboo-triggers:remote
enabled: true
configuration:
repository.change.trigger.triggerIpAddress: 10.40.1.120
triggerConditions:
com.atlassian.bamboo.triggercondition.internal:plansGreenCondition:
enabled: 'false'
triggeringRepositories:
- 7818811903068661169
branchConfiguration:
planBranchCreation:
enabled: false
removedBranchCleanup:
enabled: false
inactiveBranchesCleanup:
enabled: false
merging:
enabled: false
notificationStrategy: notifyCommitters
triggers: inherited
issueLinking: enabled
dependencies:
configuration:
enabledForBranches: 'true'
requireAllStagesPassing: null
blockingStrategy: none
childPlans: []
permissions:
users:
xxxxxxxx:
- administration
- build
- clone
- read
- write
groups: {}
roles:
user:
- read
anonymous:
- read
plugins:
- pluginKey: com.atlassian.bamboo.plugin.system.additionalBuildConfiguration:concurrentBuild
configuration:
custom.concurrentBuilds.overrideNumberOfConcurrentBuilds: 'true'
custom.concurrentBuilds.numberOfConcurrentBuilds: '1'
- pluginKey: com.atlassian.bamboo.plugin.system.additionalBuildConfiguration:buildExpiry
configuration:
custom.buildExpiryConfig.enabled: 'false'
- pluginKey: com.atlassian.bamboo.plugin.artifact.handler.local:artifactHandlersConfiguration
configuration:
custom.artifactHandlers.useCustomArtifactHandlers: 'false'
buildDefinition:
custom.predefinedVariables: '{"variableSetList":[]}'
stages:
- oid: 7818530428091950756
name: Default Stage
jobs:
- oid: 7818671165580276746
key: JOB1
name: Default Job
tasks:
- oid: 7819234115533708305
description: Checkout Default Repository
pluginKey: com.atlassian.bamboo.plugins.vcs:task.vcs.checkout
configuration:
repositories:
- ref: defaultRepository
buildDefinition:
cleanWorkingDirectory: false
repositoryDefiningWorkingDirectory: -1
...
===========================================================================
Okay, so I realized the hook and the trigger is actually working. I misunderstood the trigger setup on bamboo.
Current behavior:
Problem: I want the build to trigger once the PR is opened (before merge). To a bit more context, this is the ideal flow of my build:
I'm looking at the following links as it seems they managed to do it somehow but I can't make sense of the bits of info provided in both the links.
For the Webhooks in Bitbucket Cloud repository, is the option "Choose from a full list of triggers" selected so that it can be configured to trigger when Pull Request Created?
Since the commit exist in the repository branch, is the branch plan created at Bamboo Plan Configuration >> Branches so that it can run build with the related repository branch?
Hi, thanks for your response!
For the Webhooks in Bitbucket Cloud repository, is the option "Choose from a full list of triggers" selected so that it can be configured to trigger when Pull Request Created?
-- No, and i dont see that option either. but the Pull Request event is already selected; Meaning, the webhook is fired successfully upon opening a PR
Since the commit exist in the repository branch, is the branch plan created at Bamboo Plan Configuration >> Branches so that it can run build with the related repository branch?
-- Yes. The plan branch is already created.
Problem: If I open the PR, the bitbucket webhook is fired, but bamboo will then wait for file changes before the build is started. This means that the build will start ONLY when the PR is merged.
What I want to accomplish is automatically start the build in bamboo once a PR is opened in bitbucket and not wait for the merge to happen. This build is supposed to execute tests and will eventually signal bitbucket on the test results as an indicator whether the PR code is good to merge or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, and i dont see that option either. but the Pull Request event is already selected; Meaning, the webhook is fired successfully upon opening a PR
Just notice the screen shot that it is Bitbucket Server instead of Bitbucket Cloud. For Bitbucket Server, there is no need to create any Webhook. Bitbucket Server will trigger Bamboo by default if Application Link is created between both servers.
From the Bamboo Specs, there is no need to disable Bitbucket Server repository triggered and create Remote trigger. It will work fine with Bitbucket Server repository triggered.
Yes. The plan branch is already created.
When the branch plan is created in Bamboo, did it run for the first time? Automatic Branch creation can be configured at Plan Configuration > Branches to create branch plan when the PR is created (it will be triggered to build immediately too).
If I open the PR, the bitbucket webhook is fired, but bamboo will then wait for file changes before the build is started.
Yes, even though the PR is fired, if there is no new commit in the branch, the branch plan will not be triggered. Is there any new commit in the repository branch after the PR is created?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just notice the screen shot that it is Bitbucket Server instead of Bitbucket Cloud. For Bitbucket Server, there is no need to create any Webhook. Bitbucket Server will trigger Bamboo by default if Application Link is created between both servers.
From the Bamboo Specs, there is no need to disable Bitbucket Server repository triggered and create Remote trigger. It will work fine with Bitbucket Server repository triggered.
I used remote trigger as a workaround because I'm getting some sort of proxy issue when I use the bitbucket server trigger (bitbucket webhook request fails upon opening a PR). Will this be an issue with the setup I'm trying to do?
When the branch plan is created in Bamboo, did it run for the first time? Automatic Branch creation can be configured at Plan Configuration > Branches to create branch plan when the PR is created (it will be triggered to build immediately too).
I created the branch plan manually and tested that it builds fine by running it manually and automatically by merging the PR. The real missing bit is run it when the PR is opened.
Yes, even though the PR is fired, if there is no new commit in the branch, the branch plan will not be triggered. Is there any new commit in the repository branch after the PR is created?
Yup! I'm testing with actual commits. Would you be able to provide me a step by step guide on how to configure the plan to run on PR open?
Meanwhile, I'll explore the automatic branch plan creation. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used remote trigger as a workaround because I'm getting some sort of proxy issue when I use the bitbucket server trigger (bitbucket webhook request fails upon opening a PR). Will this be an issue with the setup I'm trying to do?
There is no need to use Bitbucket Webhook as well when using Bitbucket Server repository triggered. Bitbucket Server will still trigger Bamboo without the webhook if the Application Link is created.
Perform the following steps to confirm if the Bitbucket Server repository triggered works fine:
2018-10-03 21:59:15,983 INFO [http-nio-8085-exec-10] [AuthenticatorImpl] Authenticated app 'Bitbucket:5629199447' as user 'null' successfully
2018-10-03 21:59:15,987 INFO [http-nio-8085-exec-10] [AccessLogFilter] 127.0.0.1 POST http://localhost:8085/rest/remote-event-consumer/latest/events/stash-pullrequest-opened-remote-event 255617kb
2018-10-03 21:59:16,009 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-11] [PullRequestAwareEventListener] Received pull request opened event [ stash, from: refs/heads/testbranch to: refs/heads/master]
Meanwhile, I'll explore the automatic branch plan creation. Thanks!
If the option When pull request is created is selected at Bamboo Plan Configuration > Branches > Create plan branch , the above trigger event will automatically create a branch plan and build for the first time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perform the following steps to confirm if the Bitbucket Server repository triggered works fine:
Enable Bitbucket Server repository triggered
Disable Remote trigger
Delete the Bitbucket Webhook in Bitbucket Server
Select the option When pull request is created at Bamboo Plan Configuration > Branches > Create plan branch
Save the setting
Create a PR in Bitbucket Server
Check Bamboo log file atlassian-bamboo.log for the following message:
Hi, I don't see the "When pull request is created" at the create plan branch screen.
This is the bamboo version we're using:
Version 5.14.3.1
Build number 51416
Build date 12/5/16
Also, I confirmed that the link between bitbucket and bamboo is already configured.
Is there anything I'm missing?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Version 5.14.3.1
Its a new feature in Bamboo 6.0+
Based on your use case, Bamboo need to be upgraded to 6.0+ so that it can be configured with this new feature.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see. Thanks for the info! If you can suggest any workaround for this use case without a Bamboo upgrade that will be highly appreciated! :)
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.