How to use Bitbucket Server 5.4 webhooks with Jenkins crumbs

With version 5.4 of the Bitbucket server, Atlasian (re-)introduced the webhooks. I tried to configure a webhook to notify our Jenkins 2.83 instance but the request was refused with an "Invalid crumb" message.

Please advise how to connect the new Bitbucket server webhooks to a Jenkins 2.x instance.

Please note that the invoked Jenkins job is of type Pipeline, which executes a parameterized script from an SCM.

Here are the details of the HTTP request and response:

Request details

Event type:

Test connection event

URL endpoint:

https://jenkinshost/view/all/job/playground/job/test_pipeline/buildWithParameters

Headers

X-Request-Id: b346ae6c-f455-43f0-92c4-d5e74f922bfc
X-Event-Key: diagnostics:ping

Body

No headers

-------------------------------------------------------------------------

Response details

HTTP status:

403

Headers

Cache-Control: must-revalidate,no-cache,no-store
Server: Jetty(9.4.z-SNAPSHOT)
X-Content-Type-Options: nosniff
Content-Length: 460
Date: Wed, 11 Oct 2017 05:27:33 GMT
Via: 1.1 localhost (Apache-HttpClient/4.4.1 (cache))
Content-Type: text/html; charset=ISO-8859-1

Body

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 403 No valid crumb was included in the request</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /view/all/job/playground/job/test_pipeline/buildWithParameters. Reason:
<pre>    No valid crumb was included in the request</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>

</body>
</html>

 

1 answer

You can use Generic Webhook Trigger Plugin. It does not require the crumb.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

635 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot