Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkinsfile - How to detect destination of pull request

so I have a jenkinsfile where I have my pipeline. I would like to be able to distinguish between a pull request which is going to the master and pull requests going elsewhere. I have found example code for detecting pull requests - something like this:

env.BRANCH_NAME.startsWith('PR-')

But is there any way to find out the target of the pull request from some env. variable?

like image 509
Mike Avatar asked Oct 17 '22 10:10

Mike


1 Answers

As per https://yourjenkinsurl/pipeline-syntax/globals:

CHANGE_TARGET
For a multibranch project corresponding to some kind of change request, this will be set to the target or base branch to which the change could be merged, if supported; else unset.

like image 62
Daniel Beck Avatar answered Oct 20 '22 17:10

Daniel Beck