简体   繁体   中英

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

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.

From a pipeline you could do something like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM