JaSn
JaSn

Reputation: 229

Jenkins and Git: Monitor specific folder on any branch

My repo has multiple projects in subfolders with same structure duplicated across multiple branches.

I'm trying to set up a job that monitors all branches and triggers a job only when a change in a subdirectory 'Project1' is made. This way I can check if changes to 'Project1' work on release branches and any dev branches people might set up.

In theory it seems the Git plugin does let me set this up, by specifying '**' in 'Branches to build' and 'Project1.*' in 'Included Regions'. I also use 'Poll SCM' since that seems to be a prerequisite.

This works fine as long as you make changes only to one branch. Once you make a change outside of the 'Project1' folder on another branch, Jenkins picks up a changes from any directory.

Is this a bug or am I trying to do something that is not supported?

Upvotes: 16

Views: 20151

Answers (2)

whitediver
whitediver

Reputation: 468

It`s possible, but not recommended. You can set additional checkout behavior and then choose which folders should trigger the build and which are not.

enter image description here

Upvotes: 2

Yuri G.
Yuri G.

Reputation: 4648

I think that this answer can help you. You only need to implement the hook with the logic which project to build

Upvotes: 0

Related Questions