I have a multibranch pipeline that runs a Jenkinsfile
of select branches. Now I need to run that same Jenkinsfile
with parameters, so I figured I could use a regular pipeline.
Now all I have to do is to determine whether I run in a multibranch pipeline or not. I could check for any parameters in the build, and when there aren't any I could deduce that I'm in a multibranch pipeline:
def isMultibranchPipeline() {
!params.any()
}
I was searching for a more direct method to know whether the script is running in a multibranch pipeline or not, but couldn't find anything like it.