1

I have configured a multibranch pipeline with bitbucket repository. Have referred cloudbees link for the same . Using Post WebHooks for Bitbucket plugin installed in bitbucket as mentioned in the cloudbees link.

But the multi-branch pipeline builds are not been auto-triggered post commits . Manually scanning works fine.

Also by manually hitting webhook url https://$JENKINS_URL/bitbucket-scmsource-hook/notify?server_url=https%3A%2F%2Fbitbucket.org returns below error

java.lang.Exception: X-Event-Key HTTP header not found
    at org.kohsuke.stapler.HttpResponses.error(HttpResponses.java:83)
    at com.cloudbees.jenkins.plugins.bitbucket.hooks.BitbucketSCMSourcePushHookReceiver.doNotify(BitbucketSCMSourcePushHookReceiver.java:83)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
    at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:456)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHand

I tried implementing different kinds of hooks mechanism available for bitbucket but neither seems to be working . I don't want to use WebHook URL $JENKINS_URL/git/notifyCommit

Please help. This is really bugging me .

Alim Azad
  • 471
  • 2
  • 9
  • 23

1 Answers1

0

Post Webhook plugin was not required and our Bitbucket server instance was corrupted. Below were the steps performed that helped it to work

  1. Install Bitbucket Branch Source plugin
  2. Under Configure System -> Bitbucket Endpoints , provide bitbucket server details with "Manage Hooks" enabled and "WebHook implementation to use" set to "Plugin"
  3. Under bitbucket repository -> settings -> WebHooks, define hook url as "https://$JENKINS_URL/bitbucket-scmsource-hook/notify?server_url=https%3A%2F%2Fbitbucket.org"

Worked fine post the setup

If using Bitbucket Server Integration plugin with freestyle or maven jobs, enable option "Build when change is pushed to Bitbucket" and webhook should be created automatically with url http://$JENKINS_URL/bitbucket-server-webhook/trigger . If not created , manually create it and it should work fine

Alim Azad
  • 471
  • 2
  • 9
  • 23