如何设置Jenkins使用Bitbucket Webhook为多分支管道触发构建?

时间:2019-10-21 08:08:29

标签: jenkins jenkins-pipeline bitbucket webhooks

我正在使用Bitbucket Webhook设置Jenkins,以触发多分支管道构建。詹金斯(Jenkins)收到了Webhook,但是从不触发新的构建。

  • Jenkins版本2.190.1
  • Bitbucket插件版本:1.1.11

我已经使用2个不同的Webhook网址对此进行了测试:

  • https://[JENKINS_HOST]/bitbucket-scmsource-hook/notify/
  • https://[JENKINS_HOST]/bitbucket-hook/

它们都返回一个200状态代码,并且Jenkins也记录了Webhook:

Received commit hook notification for {
   "scm":"git",
   "website":null,
   "name":"ticketapp",
   "links":{
      "self":{
         "href":"https://api.bitbucket.org/2.0/repositories/debugged-dev/ticketapp"
      },
      "html":{
         "href":"https://bitbucket.org/debugged-dev/ticketapp"
      },
      "avatar":{
         "href":"https://bytebucket.org/ravatar/%7B8f6adab8-2fbd-4ce2-963f-6c74ab61f962%7D?ts=default"
      }
   },
   "project":{
      "key":"TIC",
      "type":"project",
      "uuid":"{186d6a27-8765-411c-9781-6cd16b3a4e6c}",
      "links":{
         "self":{
            "href":"https://api.bitbucket.org/2.0/teams/debugged-dev/projects/TIC"
         },
         "html":{
            "href":"https://bitbucket.org/account/user/debugged-dev/projects/TIC"
         },
         "avatar":{
            "href":"https://bitbucket.org/account/user/debugged-dev/projects/TIC/avatar/32"
         }
      },
      "name":"TicketApp"
   },
   "full_name":"debugged-dev/ticketapp",
   "owner":{
      "username":"debugged-dev",
      "display_name":"Debugged",
      "type":"team",
      "uuid":"{cf433a21-2d93-4ad6-838a-8a1d29406ad9}",
      "links":{
         "self":{
            "href":"https://api.bitbucket.org/2.0/teams/%7Bcf433a21-2d93-4ad6-838a-8a1d29406ad9%7D"
         },
         "html":{
            "href":"https://bitbucket.org/%7Bcf433a21-2d93-4ad6-838a-8a1d29406ad9%7D/"
         },
         "avatar":{
            "href":"https://bitbucket.org/account/debugged-dev/avatar/"
         }
      }
   },
   "type":"repository",
   "is_private":true,
   "uuid":"{8f6adab8-2fbd-4ce2-963f-6c74ab61f962}"
}

我将我的Jenkins文件编写为脚本管道:

#!/usr/bin/env groovy
...
properties([
  buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5')),
  pipelineTriggers([
    bitbucketPush()
  ])
])
...

我希望发生的事情是Jenkins触发了特定分支的新构建。但这目前还没有发生。

0 个答案:

没有答案