| After configuring everything like described on https://community.atlassian.com/t5/Bitbucket-articles/Atlassian-supported-Jenkins-integration-for-Bitbucket-Server/ba-p/1148326 , I get the same behavior as described by Kevin Reynolds: the trigger is executed in bitbucket, receives a 200 back from Jenkins, but no build is started. In the Jenkins logs I see:
Payload: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent@1b554079
Received refs changed event from repo: JG/bitbucket-sonarqube-integration
I've debugged the code and traced it down to the getScms method in BitbucketWebhookConsumer returning an empty collection. Tracing further why it's empty, I end up in the implementation in https://github.com/jenkinsci/workflow-job-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java#L528 which shows it needs at least a completed build to return a non empty collection. I feel this should rather use (from script console)
Jenkins.instance.getItem('bitbucket-sonarqube-integration').definition.scm
which returns a BitbucketSCM instance as defined in the job definition. Can easily be reproduced when removing all builds from a job. |