0

We have a microservice project architecture where there is a single project repository with several folders. Each folder has files etc for a specific API. We would like to have that as a single repo but configure separate jobs in jenkins for each API folder. As such we would like to know how to use same repo for scm checkout in jenkins but trigger builds for commits made only to the folders where changes are made. i know it supports regex to include and exclude. But would like to know how best to use that.

So say for example i have a project sample-project with 3 folders abc, def and xyz. we now have a job in jenkins that checkouts sample-project. Now we would like that jenkins job to be configured in a way that only when anything inside abc folder is changed or committed, it triggers that job otherwise not. How to best implement this.

Ashley
  • 1,447
  • 3
  • 26
  • 52
  • https://stackoverflow.com/a/47332909/6309 should help – VonC Mar 09 '19 at 06:13
  • #Ashley , Do you solved your question with # VonC suggestion? If not, Are you using free style, scripted pipeline or declarative pipeline in Jenkins? Is mandatory use just one repository for several applications? We could improve your devops flow a little bit ;) – JRichardsz Mar 10 '19 at 12:17
  • Thanks Richard. Yes i have gone through that link suggested by Von earlier. The problem is we use blue ocean for configuring jobs in Jenkins which allows multibranhc pipeline with automated triggers etc. We do use scripted Jenkinsfile for all the jobs. The problem is with blueocean the job configuration doesn't give the option for "Polling ignores commits in certain paths" under Additional Behaviours. What;s the best way to have such a job configured with automated triggers that trigger builds only based on changes in specific folders in Github. – Ashley Mar 11 '19 at 13:34
  • Ok so i was actually able to get this working for a pipeline job but that "Ignore commits for specified paths" option isn't available for multi-branch pipeline job. we want a much cleaner view under same job with multiple branches to display builds for each branch under the branch name using same configuration which is "ignore commits in certain paths". Currently using branch specifier as */* under same pipeline job works fine to build all branches but you don't have that multi-branch view as its all series of builds under same window. Any suggestions here? – Ashley Mar 11 '19 at 22:26

0 Answers0