-
New Feature
-
Resolution: Fixed
-
Major
-
Jenkins 2.3
Bitbucket-branch-source-plugin 1.5
When running with the following Jenkinsfile:
node { checkout scm echo "My branch is: ${env.BRANCH_NAME}" echo "My target branch is: ${env.CHANGE_TARGET}" }
The following is printed out:
[Pipeline] echo
My branch is: PR-4
[Pipeline] echo
My target branch is: null
I thought CHANGE_TARGET would contain the target branch but apparently I am mistaken? The setup I was thinking of is the following:
Pull request (from a fork):
- merge with target branch
- run test suite
Pull request get merged into a release branch
- run test suite
- build and deploy/publish an artifact
But it seems to be impossible to declare this in a single folder, I would also be happy to do this in two folders, but that seems impossible as well?
If there was a way to differentiate between a PR and a regular build AND get the target branch for a PR, I could keep Jenkins config to the bare minimum; the link to a repo and let multibranch / pr discovery do all the rest.
Am I maybe missing something obvious here or am I trying to do the impossible? I combed through the documentation for the plugin and the available docs and snippet generator for the pipeline scripts but came up empty.
- is related to
-
JENKINS-34931 Build merge commit instead of PR head
- Resolved
-
JENKINS-34931 Build merge commit instead of PR head
- Resolved