I am setting up a Jenkins multi-branch instance which needs to allocate a resource on branch job creation when a new branch is detected by the https://wiki.jenkins.io/display/JENKINS/Pipeline+Multibranch+Plugin plugin (version 2.21), and deallocate it when the branch job is deleted by the Multi-branch pipeline when the branch is not present in Git any more.
(To be precise, we need to ship the built binaries to an OpenShift deployment which needs to be explicitly set up and destroyed for each branch).
I have looked at the documentation, but not yet found the location where this can be configured. To my untrained eye, this would make sense to be a "stage" outside the "stages" node, but it is the same for all builds, so it could also go outside Jenkinsfile.
How can I do this?
sh("...")
command. – Prudential