简体   繁体   English

Jenkins Pipeline SCM环境变量

[英]Jenkins pipeline scm environment variables

I'm trying to print the SCM last Git commiter name in pipeline job. 我正在尝试在管道作业中打印SCM最后的Git提交者名称。 The ${CHANGE_AUTHOR} returns null. $ {CHANGE_AUTHOR}返回null。 I tried to do the following: 我尝试执行以下操作:

def scmVars = checkout scm

and print the results: 并打印结果:

println scmVars

The commits and the details are fine. 提交和细节都很好。 The problem is that the returned user is different. 问题是返回的用户不同。 In the UI is as expected (Nir Koren): 在用户界面中符合预期(Nir Koren):

Commit ********** by Nir Koren

But from the console logs GIT_COMMITTER_NAME and GIT_AUTHOR_NAME is a different user. 但是从控制台日志中,GIT_COMMITTER_NAME和GIT_AUTHOR_NAME是不同的用户。 In fact it's the technical user who created the SSH key to Github. 实际上,是技术用户创建了Github的SSH密钥。

Any idea why it's different? 知道为什么会有所不同吗? Any clue how can I print the committers name before I am implementing ugly API call the the build URL? 任何线索,在实现丑陋的API调用构建URL之前,如何打印提交者的名称?

The GIT_COMMITTER_NAME is the user that the Jenkins server would commit as, and is unrelated to the change sets pulled down for the build. GIT_COMMITTER_NAME是Jenkins服务器将作为其提交的用户,并且与为该构建下拉的更改集无关。

Documentation states: GIT_AUTHOR_NAME and GIT_COMMITTER_NAME - The name entered if the "Custom user name/e-mail address" behaviour is enabled; 文档状态:GIT_AUTHOR_NAME和GIT_COMMITTER_NAME-如果启用了“自定义用户名/电子邮件地址”行为,则输入的名称; falls back to the value entered in the Jenkins system config under "Global Config user.name Value" (if any) 退回到在Jenkins系统配置中“全局配置user.name值”下输入的值(如果有)

You should be able to do this though: 您应该可以执行以下操作:

https://support.cloudbees.com/hc/en-us/articles/217630098-How-to-access-Changelogs-in-a-Pipeline-Job- https://support.cloudbees.com/hc/zh-CN/articles/217630098-How-to-access-Changelogs-in-a-Pipeline-Job-

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

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