How to trigger a jenkins pipeline from a bitbucket

2019-03-22 17:51发布

I have successfully setup a webhook trigger in bitbucket for a Jenkins freestyle project, for test purposes.

Unfortunately my Jenkins project is using the Pipeline format, and I am unable to get Bitbucket to trigger that kind of project; the problem seems to be that there is no Jenkins project registered to pull from the repo that the Bitbucket webhook is coming from, and Jenkins replies with:

Error: Jenkins response: No git jobs using repository: ssh://git@myhost:7999/xxx/testing-jenkins.git and branches: master No Git consumers using SCM API plugin for: ssh://git@myhost:7999/xxx/testing-jenkins.git

The pipeline project is setup in a way that the Jenkinsfile is to be found in the given repository (ssh://git@myhost:7999/xxx/testing-jenkins.git), by using the "Pipeline script from SCM" option.

Therefore there is actually a kind of "git consumer" for the Pipeline, but this does not seem to be taken into account by Jenkins, probably because this is not a real project source, but a pipeline source.

Are there any examples of integration of Bitbucket and Jenkins Pipeline projects? I have been unable to find any.

7条回答
等我变得足够好
2楼-- · 2019-03-22 18:26

I have this same issue. My workaround was just to create a freestyle project that can be triggered by the WebHook, and have the the Pipeline triggered by that project's completion.

In the mean time, here's the Jenkins bug you can watch for a fix: https://issues.jenkins-ci.org/browse/JENKINS-38447

查看更多
登录 后发表回答