0

I have created a Bitbucket webhook to trigger the jenkins jobs when a change is pushed to the repository. There are several different project in the repository and for each project a separate Jenkins Job is configured.

Webhook URL goes like this: 
http://10.230.0.14:8080/git/notifyCommit?url=ssh://git@bitbucket.abc.com:7999/scm/bitbucket.git

If a change is pushed to one of the many projects in the repository, all the Jenkins jobs are getting triggered which are subscribed to that repository. I want to trigger only the job pertaining to the project, not all jobs belonging to the repository.

For an example, in repository Rep1, there are two folders: Solution1 & Solution2. Both folders have separate Jenkins jobs configured. When any change is pushed to folder Solution1, jenkins jobs related to Solution1 should only be triggered, not Solution2.

How can this be achieved?

  • A Webhook will trigger in every push, as long as I am aware of it's possible to only trigger it for certain directory in bitbucket. I think the easiest way to achieve what you want is to break the folders in different repositories. A harder way was to inspect the commit in jenkins and decide if it should build or not (I wouldn't go there though). – pabrantes Jun 23 '20 at 16:30
  • My project requirement is like that we are managing all the projects in one repository. I want to achieve this something like one repository multiple webhooks for each directory. – Manish Choudhary Jun 23 '20 at 17:24

0 Answers0