Ashwin
Ashwin

Reputation: 1013

Trigger Jenkins job only if there is a code change in certain folders

I have a Jenkins job hooked up to Github repo and this job is triggered externally (I do not have permission to configure the parent job). Now I want to run the job only if there is a code change in certain dirs and ignore running this job if there is only changes in certain dir like doc, .. etc

I found that under Source Code Management -> Addition Behaviour section, there is a option called 'Polling ignores commits in certain paths' (Jenkins Git plugin) and configured the following,

Included Regions:
    [project]/src/.*
    [project]/test/.*
    [project]/scripts/.*


Excluded Regions:
    [project]/doc/.*

But using this, if there is a change only in the doc folder also, the build is been triggered and run by the job. How to fix this ?

Upvotes: 1

Views: 1709

Answers (1)

Steven Scott
Steven Scott

Reputation: 11250

I do not have the [project] reference in my regions. I use the the relative path from the workspace.

Excluded Regions:

doc/.*

So I have a Typescript code build that uses this: Emulator/src/.*\.ts

Maybe you need the extra extensions for your build?

Upvotes: 1

Related Questions