仅在PR上从BitBucket Server Webhook进行远程触发Bamboo构建?

时间:2018-09-26 04:11:40

标签: bitbucket webhooks bamboo bitbucket-server

我是竹子和网络钩子的新手。我正在尝试从我的存储库中打开主分支的PR时,自动开始创建Bamboo。

我遵循了this指南,但是远程触发器根本没有启动。

竹:
enter image description here

BitBucket:
enter image description here

我已经检查了以下内容:

  • 验证列入白名单的IP是否正确(如果我删除了该位桶,则它会失败)

  • 我的竹计划已启用,并且在手动运行时可以正常构建

我想念什么?

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

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

编辑1:

好的,所以我意识到了钩子和触发器确实在起作用。我误解了竹子上的触发器设置。

当前行为:

  1. 主控PR已打开
  2. BitBucket Webhook(在PR上)被触发
  3. Bamboo触发器设置为远程/ bitbucket服务器存储库。因此,直到提交更改/ PR实际合并后,构建才会开始

问题: 我希望PR打开后(合并之前)触发构建。在更多情况下,这是我构建的理想流程:

  1. 检出PR代码(修订版)
  2. 针对PR版本运行测试

我正在查看以下链接,因为他们似乎设法以某种方式做到了,但我无法理解两个链接中提供的信息。

  • bamboo - build my pull request
  • What's wrong with bamboo

  • 2 个答案:

    答案 0 :(得分:2)

    由于您使用的是Bamboo和Bitbucket服务器(不是Cloud),请按照此处的说明进行操作:

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

    您需要在Bamboo和BBS之间创建一个应用程序链接-应用程序链接位于Atlassian应用程序之间。

    答案 1 :(得分:1)

    发现从Bamboo 6+开始,该功能即开即用:Reference