Jenkins GitHub pull request builder - get branch name for execute shell

狂风中的少年 提交于 2020-05-13 06:27:30

问题


I am using Jenkins GitHub pull request builder plugin for running my unit tests when a pull request is made vis a vis a web hook. For the build step, I need to know the name of the branch that is being merged in (e.g. I need develop branch if merging that into master branch). Is there a way to get access to this in the Jenkins execute shell? Thanks,


回答1:


Your link has the answer:

The plugin makes some very useful environment variables available.

  1. ghprbActualCommit

  2. ghprbActualCommitAuthor

  3. ghprbActualCommitAuthorEmail

  4. ghprbPullDescription

  5. ghprbPullId

  6. ghprbPullLink

  7. ghprbPullTitle

  8. ghprbSourceBranch

  9. ghprbTargetBranch

  10. sha1

You'll want to use $ghprbSourceBranch to get the value of the branch being built somewhere else in your script.



来源:https://stackoverflow.com/questions/30926515/jenkins-github-pull-request-builder-get-branch-name-for-execute-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!