Jenkins: trigger the same job from different BitBucket repositories

佐手、 提交于 2020-01-25 09:05:56

问题


I have 50+ repositories in a BitBucket project and I want them to execute the same job when a commit is pushed (that is maven build and deploy to artifactory). I tried to create a Maven job and make it work, but that can be linked to only one repository. I also tried installing the Bitbucket Team plugin and creating a project with it, and I think this could lead to a solution. In fact I saw that it scans automatically all the repositories with a JenkinsFile in it, so I thought that I could create a common Pipeline on jenkins and call this pipeline from every JenkinsFile in every repository. The problem is that I still have to create a JenkinsFile for each repository, and I don't want to do that. Is there anyway that I can trigger the same Jenkins job from all my repositories?


回答1:


You can use Remote File Plugin for this. What you need to do is,

  • Create a separate repository and put your Jenkins file into it.
  • Define this repository and Jenkins file in the Remote File section of the BitBucket Team Project configuration page.

This way, for every repository in your BitBucket, this Jenkins file will be run.

Hope this helps.

You can find the example screenshot below.

You can find it under Project Recognizers




回答2:


It is under the Project Recognizers



来源:https://stackoverflow.com/questions/58874987/jenkins-trigger-the-same-job-from-different-bitbucket-repositories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!