4

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:
enter image description here

BitBucket:
enter image description here

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

What am I missing?

Bamboo build 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
...

===========================================================================

EDIT 1:

Okay, so I realized the hook and the trigger is actually working. I misunderstood the trigger setup on bamboo.

Current behavior:

  1. PR to master is opened
  2. BitBucket webhook (on PR) is fired
  3. Bamboo trigger is set to remote / bitbucket server repo. Because of this, the build will not start until the changes are commited / PR is actually merged

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:

  1. Checkout the PR code (revision)
  2. Run my tests against the PR revision

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.

  • bamboo - build my pull request
  • What's wrong with bamboo
  • TylerH
    • 20,799
    • 66
    • 75
    • 101
    iamkenos
    • 1,446
    • 8
    • 24
    • 49
    • Which Git Server are you using? If you're using Bitbucket Server you don't need to set up webhooks just follow the integration guide. If you're using GitHub Enterprise check to see if there is a supported integration there. – Rich Duncan Sep 27 '18 at 12:34
    • I'm using BitBucket and I'm already following this guide: https://confluence.atlassian.com/bamkb/how-to-trigger-a-bamboo-build-from-bitbucket-cloud-using-a-webhook-872271665.html. Still the bamboo remote trigger isn't working to start the build even though the bitbucket hook has fired. – iamkenos Sep 28 '18 at 02:19
    • Just to be sure - you mean Bitbucket Cloud right? – Rich Duncan Sep 28 '18 at 17:05
    • Bitbucket server. I've updated the question for this. thanks! – iamkenos Oct 01 '18 at 03:21

    2 Answers2

    2

    Since you are using Bamboo and Bitbucket Server (not Cloud), follow the instructions here:

    https://confluence.atlassian.com/bamboo/integrating-bamboo-with-bitbucket-server-779302772.html

    You need to create an application link between Bamboo and BBS - application links are between Atlassian applications.

    Rich Duncan
    • 1,845
    • 1
    • 12
    • 13
    1

    Found out that this feature is supported out of the box as of Bamboo 6+: Reference

    iamkenos
    • 1,446
    • 8
    • 24
    • 49