如何确定使用jenkins git插件在git中推送到远程回购的用户? [英] How to determine the user who pushed to a remote repo in git using jenkins git plugin?
本文介绍了如何确定使用jenkins git插件在git中推送到远程回购的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
推送更改的人员的git用户名/电子邮件,包含不同用户提交的不同提交。通过触发jenkins作业的gitblit触发Post-Receive挂钩,并使用非用户特定的SSH身份验证。
解决方案
我不得不
- 定义一个gitblit用户并使用它来推送更改。
- 将我的jenkins作业更改为参数化的作业并为用户名(myuser)定义一个参数。
- 在我的hook中添加用户名 >
。
def triggerUrl = jenkinsUrl + / job /+ jenkinsJob +/ buildWithParameters?token =+ jenkinsToken +& myuser =+ user.getName()
new URL(triggerUrl).getText()
myuser现在是一个环境变量,这里作为一个ant脚本的例子:
< property environment =env/>
< target name =xxdescription =xx>
< echo message =$ {env.myuser}/>
< / target>
I need to find the git username/email of a person who is pushing changes, consisting of different commits by different users, to a remote repository.
The push triggers a Post-Receive hook via gitblit which triggers a jenkins job, and is using a non user specific SSH authentication.
解决方案
I had to
- define a gitblit user and use it for pushing the changes.
- change my jenkins job to a parameterized one and define a parameter for the username (myuser).
- add the username in my hook
.
def triggerUrl = jenkinsUrl + "/job/" + jenkinsJob + "/buildWithParameters?token=" + jenkinsToken + "&myuser=" + user.getName()
new URL(triggerUrl).getText()
myuser is now an enviroment variable, here as an example in an ant script :
<property environment="env" />
<target name="xx" description="xx">
<echo message="${env.myuser}" />
</target>
这篇关于如何确定使用jenkins git插件在git中推送到远程回购的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文