简体   繁体   English

Bitbucket Webhook到Jenkins

[英]Bitbucket webhook to Jenkins

I want to configure Jenkins build on every commit to specific branch. 我想在对特定分支的每次提交上配置Jenkins构建。 I am trying to use Bitbucket Webhook to Jenkins but it is not working as per expectations. 我正在尝试对Jenkins使用Bitbucket Webhook,但按预期效果不佳 To run it successfully I need to select following two options in Jenkins job 1.Build when a change is pushed to BitBucket and 2. Poll SCM(keeping it blank) 为了成功运行它,我需要在Jenkins作业中选择以下两个选项:1. 将更改推送到BitBucket时构建; 2.轮询SCM(将其保留为空白)

and in webhook as below screenshot 并在webhook中如下图所示

在此处输入图片说明

When I untick Omit Branch Name it gives following error. 当我取消选中省略分支名称时 ,会出现以下错误。

在此处输入图片说明

When I mention branch name to build from in Advance Configurations to Build Options : as below 当我提到要从“高级配置”到“构建选项”中构建的分支名称时,如下所示 在此处输入图片说明

it give following error in logs and do not trigger any build in Jenkins. 它在日志中给出以下错误,并且不会在Jenkins中触发任何构建。

2017-07-28 19:18:49,382 ERROR [AtlassianEvent::thread-3] XXXXXXX @4NXRG4x1158x165x0 s2l8ua 10.229.17.70 "PUT /rest/api/latest/projects/STCPLAY/repos/mavensample/browse/pom.xml HTTP/1.1" c.a.s.i.e.AsyncBatchingInvokersTransformer There was an exception thrown trying to dispatch event 'com.atlassian.bitbucket.event.content.FileEditedEvent[source=com.atlassian.stash.internal.content.DefaultContentService@72ae21ba]' for the invoker 'SingleParameterMethodListenerInvoker{method=public void com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(com.atlassian.bitbucket.event.repository.RepositoryRefsChangedEvent), listener=com.nerdwin15.stash.webhook.RepositoryChangeListener@356e810b}'
java.lang.RuntimeException: com.atlassian.bitbucket.repository.RefChange.getRefId()Ljava/lang/String;. Listener: com.nerdwin15.stash.webhook.RepositoryChangeListener event: com.atlassian.bitbucket.event.content.FileEditedEvent
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:55)
    at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:109)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:38)
    at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    ... 1 frame trimmed

Anyone faced this issue and fixed it ? 有人面对这个问题并解决了吗? Or there is any other better way to trigger builds on commits pushed to bitbucket on specific branch. 或者,还有其他更好的方法来触发特定分支上推送到位桶的提交的构建。

A couple of suggestions: 一些建议:

  1. You may need to ensure that the branch spec on the Jenkins job ( Branches to build ) matches the branches that you specify in Branch Options in the BitBucket plugin configuration. 您可能需要确保Jenkins作业的分支规范( Branches to build的分支)与您在BitBucket插件配置的“ Branch Options中指定的分支匹配。
  2. As far as I know, the Build when a change is pushed to BitBucket option is irrelevant in this case. 据我所知,在这种情况下,将Build when a change is pushed to BitBucket选项是不相关的。

You can find more detailed instructions here - https://support.cloudbees.com/hc/en-us/articles/226568007-How-to-Trigger-Non-Multibranch-Jobs-from-BitBucket-Server- 您可以在此处找到更详细的说明-https: //support.cloudbees.com/hc/zh-CN/articles/226568007-How-to-Trigger-Non-Multibranch-Jobs-from-BitBucket-Server-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM