#${BUILD_NUMBER}_${PROPFILE,file="parameters.properties",property="BUILD_TYPE"}
或者,您可以使用Description Setter Plugin根据构建输出更改构建描述(也显示在Build Executor状态中).同样,您可以使用相同的技巧并使用shell脚本在构建输出中打印分支名称,并使用正则表达式从构建日志中解析它.
一个小的限制:其中任何一个只会在作业完成后更新名称/描述,因此对于长时间运行的作业,它不会立即可见.但对于简短的,并且出于审计目的,这很有效.
[编辑]
一段时间后,我开始使用EnvInject plugin,它将我的构建参数尽早添加到环境中,以便Build Name Setter Plugin使用它们.这具有立即设置构建名称的优点.
此外,您可以使用${GIT_BRANCH}获取Git分支.这是它的文档:
${GIT_BRANCH} Expands to the name of the branch that was built. Parameters: all If specified, all the branches that point to the given commit is listed. By default, the token expands to just one of them. fullName If specified, this token expands to the full branch name, such as 'origin/master'. Otherwise, it only expands to the short name, such as 'master'.
精彩评论