Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,945
Community Members
 
Community Events
176
Community Groups

Bitbucket Cloud integration with Jenkins 403 no valid crumb

Using Bitbucket Cloud (not Server) and created a webhook specifying our Jenkins server. The Jenkins server has the Bitbucket Branch Source Plugin installed and configured with the Bitbucket endpoint and credentials for accessing Bitbucket from Jenkins. The webhook executes and I trace the POST through the nginx proxy server to the Jenkins server and back. The reply is a 403 with the message about "no valid crumb". This is because CSRF is turned on in Jenkins global security along with the Defautl Crumb Issuer and proxy compatibility enabled. If I turn off CSRF in Jenkins, then I get a permission denied for anonymous user instead of the "no valid crumb" error. CloudBees has a good description at https://support.cloudbees.com/hc/en-us/articles/219257077-CSRF-Protection-Explained on why/who to create a crumb.

So my question is how to configure the webhook for create and send a valid crumb in the header along with the Bitbucket originated webhook request? According to CloudBees, the crumb expires so it needs to be dynamically generated by the webhook trigger. I don't see any documentation for Bitbucket about handling authentication with webhooks. (Creating a valid crumb requires contacting the Jenkins server with a username/password and a crumb request)

Has anyone successfully used a Bitbucket Cloud webhook to trigger a Jenkins build where Jenkins has authentication configured along with CSRF. Wondering if there is another way to tackle this problem.

Thank you, Cecil

2 answers

1 accepted

3 votes
Answer accepted

Finally found an answer that works for me. I set my webhook URL to the Jenkins server with "/bitbucket-scmsource-hook/notify" and now git push causes Bitbucket to successfully trigger a build in Jenkins. Documented by CloudBees at:

https://support.cloudbees.com/hc/en-us/articles/11500005113-How-to-Trigger-Multibranch-Jobs-from-BitBucket-Cloud-

 

I tried "/bitbucket-hook/" and that successfully connected to the Jenkins server and returned a 200 status code but Jenkins did not start a build or a scan. Seems that this url works for non-multi-branch jobs.

I am using Mutltibranch Pipline jobs and have the scan set to 1 day. Defining a periodic scan is required per documentation and testing. 

Like Chris DeGreef likes this

I was able to get it to work by rolling the plugin back to the previous version.  I did this after trying all the other posted fixes I found on the web. 

Could you please share which exact version of the plugin did you use?

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events