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
46 stars 50 forks source link

Triggering build works but Jenkins does not decline PR on failed build #290

Open jmeit-fwdsec opened 1 year ago

jmeit-fwdsec commented 1 year ago

After making a PR on bitbucket, the plugin successfully starts a new build on Jenkins. After the build fails, the PR should be declined because I have ticked the box that says "Let Jenkins decline the pull request on BitBucket if the build fails".

The log shows that the webhook is working from bitbucket and then shows the payload that was received by Jenkins. Then it shows the following...

Nov 04, 2022 11:29:56 PM FINE io.jenkins.plugins.bitbucketpushandpullrequest.observer.BitBucketPPRObserverFactory
Add BitBucketPPRPullRequestCloudObserver for {}

Nov 04, 2022 11:29:56 PM INFO io.jenkins.plugins.bitbucketpushandpullrequest.processor.BitBucketPPRPayloadProcessorFactory createProcessor
Create BitBucketPPRPullRequestCloudPayloadProcessor

Nov 04, 2022 11:29:56 PM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Trigger not set

Nov 04, 2022 11:29:56 PM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Trigger not set

Nov 04, 2022 11:29:56 PM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Trigger not set

And it repeats "Trigger not set" many many times.

I have stored my OAuth consumer key as Secret Text, and selected it as the Credentials.

What more can I try?

martens-d commented 1 year ago

1.: "Trigger not set" is written to the log for EVERY pipeline in Jenkins that is not configured for bitbucket (all other jobs in Jenkins).

2.: for OAuth consumer key, I could not get that to work. But what works is a decline like the approve I described here: https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/issues/288#issuecomment-1306828733

for the decline look here: https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287172368

and put that in the

post {
  failure {
    ...
  }
}

section