Is there a hook/post action, etc. in Jenkins when working with Multibranch Workflows Pipeline so that an action can be executed after (or just before) the branch is deleted?
I need to clean up some resources after branch has been removed, but google gives zero clues on that.
I could always have a hook from github side, but wondering is something similar in Jenkins:
I have not tested this, but there is a multibranch-job-teardown-plugin which should allow release of resources.
For the setup you might have to fall back on evaluating your build history to find out if this is the first run of a job. Checking currentBuild.getPreviousBuild()
for null
should help to discover this, allowing to allocate some resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With