Hello Jenkins users,
I have a Multibrach-Pipeline on my Jenkins which creates a job per branch.
branch1,branch2,branch3
These jobs create jobs again via the jobdsl-plugin in Jenkinsfile:
def createJob(jobFile) {
def job = readFile (jobFile)
jobDsl scriptText: job
}
with jobFile is something like:
pipelineJob("branch1-job1") {
environmentVariables {
[...]
}
throttleConcurrentBuilds {
[...]
}
triggers {
[...]
}
definition {
cps {
script(readFileFromWorkspace('jenkins/jobPipelineDef.groovy'))
sandbox()
}
}
}
Now my question: Is there a way to delete the pipelineJob(branch1-job1) if the job for branch1 is deleted by the Multibranch-Pipeline? Or do I have to manually determine the jobs and delete them via the jobDsl-plugin?
Platform: Jenkins ver. 2.46.2 with all plugins are up to date.
Perhaps one of you can help me.
Thanks!
Robert