I have a Jenkins that uses a project with several branches . That is, when a new branch is created in the repository, Jenkins will automatically automatically create a new task for the branch and delete that task when the branch is deleted.
Now I want to run the code when deleting a branch in order to clean up the test environments created when creating the branch. Is this a way to do this?
Not without writing the plugin code, I think. If you're interested, the corresponding extension point would be OrphanedItemStrategy from the cloudbees-folder plugin.
OrphanedItemStrategy
cloudbees-folder