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

Bitbuckt PPR Plugin: request failed. #243

Closed pawarpriya03 closed 2 months ago

pawarpriya03 commented 2 years ago

Bitbuckt PPR Plugin: request failed. HTTP status:400

Getting HTTP status:400 and Bitbuckt PPR Plugin: request failed. response when clicking in Test Connection in Bitbucket webhook configuration.

Please suggest what configuration I am missing?

Bitbucket version: v7.15.1 Bitbucket PPR Plugin: 2.8.1

y0zg commented 2 years ago

Ensure hook URL is configured https://plugins.jenkins.io/bitbucket-push-and-pull-request/#plugin-content-configure-the-webhook

Jenkins restart might be needed after hook configuration

JulianUO commented 2 years ago

Is not a configuration problem. I had the exact same issue and downgrading to 2.7.2 fixed it. Credentials are not used as documented: "Credentials for the webhook endpoint are not required."

y0zg commented 2 years ago

Which jenkins version do you use? Do you have any specific crimb/cross site configs? I use the latest jenkins LTS https://www.jenkins.io/changelog-stable/ and webhooks with the latest Bitbucket PPR Plugin 2.8.1 work like a charm. Moreover, I had multiple redeployments and didn't face any issue with webhooks

JulianUO commented 2 years ago

We also pull the LTS image every time we update. Last update we did to Jenkins was 2 weeks ago, so we're running 2.319.1. It is pretty weird, until friday it was working ok, on monday the devs made some merges and pipelines were never fired.

curtisgcarroll commented 2 years ago

Anyone else have thoughts on this issue? Or found resolutions besides downgrading? I am seeing this same issue as well and the only output from io.jenkins.plugins.bitbucketpushandpullrequest logs is "Received POST request over Bitbucket hook."

Side question, does anyone have a good list of of all loggers to look at to diagnose deeper?

sudaan commented 2 years ago

I solved this issue by changing the url from ssh to https in the SCM. Before I change that, I see create branch from jira UI directly is able to trigger the service. But code pushed does not trigger. As I downgrade the plugin version to 2.7.2, in the Jenkins log I saw it try to match the url which start with https, and in the job SCM we are using ssh. After change that, I am able to see the code push event get triggered. And then I test connection in webhook page, I get 200. Bitbucket Server version 7.21 Bitbucket PPR Plugin: 2.8.1

sudaan commented 2 years ago

But I saw that in the document the username && password credential will be removed. I am not sure whether that will break in the future because for https url we are using username && password to fetch the code

Screen Shot 2022-04-13 at 3 03 54 PM
jkurek1 commented 2 years ago

I have the same issue:

Bitbuckt PPR Plugin: request failed.
cdelmonte-zg commented 2 years ago

Hello @Chivolta, @sudaan, @pawarpriya03, @JulianUO and @y0zg

I just released the beta release ## 2.8.2-beta-1 for this bug Is the issue still present?

Tnx Cdm

piotrlg commented 2 years ago

Hi @cdelmonte-zg I had the same issue with 2.8.1, and after installing 2.8.2-beta webhook test status return 200 instead of 400. So it looks good.

piotrlg commented 2 years ago

But in the jenkins logs I can see this:

Found invalid crumb 52e87038a65ae2c26dde34d956f4ba781b350b01b042d4c547e9690c4ef41977. If you are calling this URL with a script, please use the API Token instead. More information: https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script

Jun 15, 2022 4:57:35 PM WARNING hudson.security.csrf.CrumbFilter doFilter

No valid crumb was included in request for /ajaxExecutors by piotrlg. Returning 403.

And of course pipeline was not triggered. Strange because the 'crumb' problem was reported during test connections from Bitbucket server webhook definition page. And there I have still green 200 not 403 status.

julioc-p commented 2 months ago

Since the error is no longer present and the plugin uses Crumb Exclusion this issue will be closed