title: How can I delete a job and run cleanup code with JobDSL in Jenkins?
body: <p>Similar to this question: <a href="https://stackoverflow.com/questions/33784488/how-can-i-delete-a-job-using-job-dsl-pluginscript-in-jenkins#_=_">https://stackoverflow.com/questions/33784488/how-can-i-delete-a-job-using-job-dsl-pluginscript-in-jenkins#<em>=</em></a> </p>
  
  <p>The issue is if I add <code>removeAction('DELETE')</code> to the DSL, the job will be deleted which is what I want, but I'd also like to run some cleanup code. Is there a way to query JobDSL, or get a delta of the new jobs being created vs what previously existed last run?</p>
  
  <p>The context is, I am using JobDSL to create a pipeline job for each branch that exists in a GIT repository. When the branch is deleted, I want to remove the job and run some cleanup code.</p>