jenkinsci / bitbucket-push-and-pull-request-plugin

Plugin for Jenkins v2.138.2 or later, that triggers job builds on Bitbucket's push and pull request events.
https://plugins.jenkins.io/bitbucket-push-and-pull-request
MIT License
47 stars 49 forks source link

Authentication required / 403 No valid crumb ... #193

Closed ololologist closed 2 years ago

ololologist commented 3 years ago

Hello, we are trying to trigger our SeedJob when a PR is merged to the master branch in our BitBucket repo. Here is what has been done.

Jenkins

Our Jenkins is running inside a private subnet in AWS VPC on Ubuntu Server 20.04.2 LTS, so we have tried to follow these instruction and apply smee.io delivery service. We have installed smee-client and we use the following line to bind it with Jenkins webhook endpoint # smee --url https://smee.io/%smee_string% --target http://127.0.0.1:8080/bitbucket-hook/ Forwarding https://smee.io/%smee_string% to http://127.0.0.1:8080/bitbucket-hook/ Connected https://smee.io/%smee_string%

BitBucket

We have created a webhook in the BB repo BitBucket -> Repository -> Repository Settings -> Webhooks -> Add webhook

Screen Shot 2021-09-01 at 5 44 08 PM

and we can see that the payloads can actually reach smee.io Screen Shot 2021-09-01 at 5 47 21 PM

Anyway when a BB event payload I can see following errors in the log Error: cannot POST /bitbucket-hook/ (403) ... Error 403 No valid crumb was included in the request full log

After adding -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true to /etc/default/jenkins and restarting Jenkins the error log shows the following

Error: cannot POST /bitbucket-hook/ (403) ... Authentication required full log

Could anyone please kindly guide me to any solution possible?

derhecht commented 3 years ago

read https://confluence.atlassian.com/bitbucketserver/manage-webhooks-938025878.html already? what is the output of your payload check in BB? on which server/service is the 403 produced?