Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 516
JaSn Avatar asked Apr 21 '15 18:04

JaSn


People also ask

How does Jenkins and Git work together?

With the help of the Git plugin Jenkins can easily pull source code from any Git repository that the Jenkins build node can access. The GitHub plugin extends upon that integration further by providing improved bi-directional integration with GitHub.

How do I link my Git repository to Jenkins?

Step 1: go to your GitHub repository and click on 'Settings'. Step 2: Click on Webhooks and then click on 'Add webhook'. Step 3: In the 'Payload URL' field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/.

How does Jenkins integrate with local Git?

How does Jenkins integrate with Git? Go to Jenkins dashboard, click on “Manage Jenkins.” Now follow these steps- Manage Plugins -> 'Available' tab -> Enter Git in search bar and filter -> Install required plugin. After the installation, all you need to do is click on “Configure System” and go to the 'GitHub' section.


1 Answers

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

like image 182
whitediver Avatar answered Sep 19 '22 12:09

whitediver