How to restrict from regeneration of all the jobs in Jenkins Job-DSL

467 Views Asked by At

I have a bunch of DSL scripts corresponding to my Jenkins Jobs which is placed in my github repository. Right now, whenever I run my seed job, all the jobs gets regenerated. Is there any way to make the Job-DSL plugin to regenerate only the jobs which have a change (in their DSL script).

I am aware of the ignore action for the "Action for existing jobs and views" option in the Job-DSL seed job. But this is not much helpful here as this option will ignore changes for all the existing jobs.

1

There are 1 best solutions below

0
On

From a pipeline you could do something like this

def changedFiles = script returnStdout: true, script: "git diff ^HEAD --name-only"
changedFiles.each{
    jobDSL ...
}