简体   繁体   English

在jenkins“更改”屏幕中添加git分支的简单方法是什么?

[英]What's a simple way to add the git branch in jenkins “changes” screen?

We're using jenkins with the git plugin (github remote), and in the "branches to build" we specify "**", which builds any branch that was changed. 我们在git插件(github远程版)上使用jenkins,在“要创建的分支”中指定“ **”,它可以构建任何已更改的分支。

However, the "changes" screen displays only the git commits sha1 and commit message. 但是,“更改”屏幕仅显示git commits sha1和commit消息。 Is there any simple way to add the branch name to the text? 有没有简单的方法可以在文本中添加分支名称? or even better, to the jenkins build ID? 甚至更好,让詹金斯建立ID?

Might be related to How to receive local Git branch name with Jenkins Git plugin? 可能与如何使用Jenkins Git插件接收本地Git分支名称有关? , but not sure how to use that info... ,但不确定如何使用该信息...

The answer is using Build Name Setter Plugin . 答案是使用Build Name Setter插件

  1. Install Build Name Setter Plugin. 安装内部名称设置器插件。 Check here if you don't know how to install an jenkins plugin. 如果您不知道如何安装je​​nkins插件,请查看此处
  2. In your Job Config page, scroll down to Build Environment section, set the build name like #${BUILD_NUMBER}_${GIT_BRANCH} 在“作业配置”页面中,向下滚动至“ 构建环境”部分,将构建名称设置为#${BUILD_NUMBER}_${GIT_BRANCH}

在此处输入图片说明

  1. After that, you can see branch name either in the build label or in the changes screen. 之后,您可以在构建标签或更改屏幕中看到分支名称。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM