我正在尝试检测是否在分支上创建了拉取请求。
来自阅读https://ci.eclipse.org/webtools/env-vars.html/
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.
def isPullRequest = env.CHANGE_TARGET == 'master'
isPullRequest
在创建拉取请求并与 master 合并时应解析为 true,或者在创建拉取请求时 isPullRequest
为 true?
最佳答案
在我们的例子中,对于由 Bitbucket 中的提交触发的多分支管道项目,我们只需测试分支名称:
stages {
stage('Build') {
steps {
script {
if (BRANCH_NAME ==~ /PR-.*/)) {
...
}
}
}
}
}
关于Jenkins 环境变量 - 检测拉取请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60616238/