Skip to content

Webhook didn't trigger job #177

@DimitrisFragos

Description

@DimitrisFragos

Hi guys,

I'm trying to trigger a job from a bitbucket server with no success.

I'm using:
Jenkins v2.235.5
JobDSL v1.77
Configuration as Code v1.41
Bitbucket Push and Pull Request Plugin v2.7.2

I want to trigger the job after a Pull Request is Merged so i create the above pipelineJob

#!/usr/bin/env groovy

pipelineJob('testJenkins/bitbucketTest') {
    displayName('bitbucketTest')
    logRotator {
        numToKeep(10)
        daysToKeep(30)
    }
    concurrentBuild(false)
    parameters {
        stringParam('MS_NAME', 'ms', 'From OpenShift Build Environment Variable')
    }
    triggers{
        bitbucketTriggers {
            pullRequestServerMergedAction()
        }
    }


    definition {
        cpsScm {
            scm {
                git {
                    remote {
                        url('http://hostname/bitbucket/scm/repo/ms.git')
                    }
                    branches('**')
                }
            }
            scriptPath('Jenkinsfile')
        }
    }
}

Also I setup a logger and the output is:

Received x-event-key: repo:refs_changed from Bitbucket
Apr 23, 2021 3:17:14 PM FINEST io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver
the payload is: bla bla 

Apr 23, 2021 3:17:14 PM INFO io.jenkins.plugins.bitbucketpushandpullrequest.processor.BitBucketPPRPayloadProcessorFactory createProcessor
Create BitBucketPPRRepositoryServerPayloadProcessor
Apr 23, 2021 3:17:14 PM INFO io.jenkins.plugins.bitbucketpushandpullrequest.observer.BitBucketPPRObserverFactory createObservable
Add BitBucketPPRPushServerObserver for BitBucketPPREvent [event=repo, action=refs_changed]
Apr 23, 2021 3:17:14 PM FINEST io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver
the selected payload processor is: io.jenkins.plugins.bitbucketpushandpullrequest.processor.BitBucketPPRRepositoryServerPayloadProcessor@5356bab
Apr 23, 2021 3:17:14 PM INFO io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRServerRepositoryAction 
Received commit hook notification from server for destination branch: develop
Apr 23, 2021 3:17:14 PM INFO io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRServerRepositoryAction 
Received commit hook type from server: BRANCH
Apr 23, 2021 3:17:14 PM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Considering remote [http://hostname/bitbucket/scm/repo/ms.git, ssh://git@hostname:7999/repo/ms.git]
Considering candidate job bitbucketTest
Apr 23, 2021 3:17:14 PM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Considering to poke testJenkins » bitbucketTest
Apr 23, 2021 3:17:14 PM FINEST io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver
Sending response.
Apr 23, 2021 3:17:14 PM INFO io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver doIndex
Response sent.

Also I tried multiple combination of branches and regex at "branches" field, at both pullRequestServerMergedAction(allowedBranches: '') and branches('')
And the job didn't triggered.
Any ideas ?
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions