简体   繁体   中英

Triggering Multi Branch Pipeline Jenkins job using the git webhook not working

I have a multi branch pipeline job that is configured like this:

工作配置

Polling is also configured for it:

民意调查

When new commits are pushed to its configured Git repo, after polling, the Job is triggered as expected. In the console output the Git repo is logged as https://stash.example.com/scm/eg/project.git .

However when I try to trigger the job using the git notifyCommit webhook, I get this error message:

$ curl 'http://jenkins.example.com/git/notifyCommit?url=https://stash.example.com/scm/eg/project.git'
No git jobs using repository: https://stash.example.com/scm/eg/project.git and branches:
No Git consumers using SCM API plugin for: https://stash.example.com/scm/eg/project.git

What is missing here? Why Jenkins cannot find any jobs/git consumers for this repo to trigger it?

The reason you are getting that error is that you are using BitBucket Plugin in your job configuration so you can't you get notify endpoint to trigger builds using curl request. Also, GitNotify endpoint is part of Github plugin which scans all the job configuration which has used GitPlugin and then it cross-matched the URL of the curl request with the URL od repo used in git plugin. So, If you want to use bitbucket then follow the Instruction Documented on https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/381419546/Configuring+Webhook+To+Jenkins+for+Bitbucket+Bitbucket+Branch+Source+Plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM