As you can see in the attached screenshot, I want my pipeline to fetch the Jenkinsfile from the same branch that is passed in as a parameter and saved in the BRANCH_NAME variable:
As you can see in the attached screenshot, I want my pipeline to fetch the Jenkinsfile from the same branch that is passed in as a parameter and saved in the BRANCH_NAME variable:
I had to uncheck "Lightweight checkout" to make Jenkins parse the ${BRANCH_NAME} parameter under the Pipeline SCM settings:
See below:
checkout([$class: 'GitSCM', branches: [[name: "${BRANCH_NAME}"]], [[credentialsId: 'CRED_ID', url: 'https://url.goes.here']]])
To be more explicit, you could use ${params.BRANCH_NAME}