I have the following use case
- I have a jenkins pipeline that can trigger either by Bitbucket Push Pull Request Plugin or via Manual Trigger
- I use Git SCM plugin to checkout the code to build. The problem here is under different conditions my branch to be checkout will be different
a . Manual Trigger → Branch input by user
b. Bitbucket Pull Request create/update → Source Branch of PR (taken from env variables)
c. Bitbucket Pull Request merge → Destionation Branch of PR (taken from env variables)
Is there a way i can set a config for the SCM to choose branch on the basis of this logic. Trying a regex in branch section didn’t help
I need this feature in order to put my Jenkinsfile as a part of the repo itself. Otherwise currently my jenkinsfile resides in a separate repo which the SCM plugin checks out and inside the pipeline script i checkout the actual repo based on the above conditions.