简体   繁体   English

触发基于提交作者的Jenkins构建?

[英]Trigger a Jenkins Build based on Commit Author?

The team I work on has 4 developers. 我工作的团队有4个开发人员。 The desired workflow is for each developer to have their own jenkins project and for any branch they push to, to trigger a build. 对于每个开发人员来说,理想的工作流程是拥有自己的jenkins项目以及他们推送到的任何分支以触发构建。 It doesn't look like it's possible from the Git plugin, and there doesn't seem to be a way to select a branch based on the set of commit authors. 从Git插件看来这是不可能的,而且似乎没有一种方法可以根据提交作者集来选择分支。 It seems like we could come up with magic branch names and trigger each team member's project based on the branch name, but a branch might be passed around to multiple developers to work on a large issue. 似乎我们可以想出魔术的分支名称,并根据分支名称触发每个团队成员的项目,但是分支可能会传递给多个开发人员以处理大问题。

There is an option in the Git plugin to do the opposite = exclude a list of users: Git插件中有一个选项可以执行相反的操作=排除用户列表:

在此处输入图片说明

As your team is quite small (4 developers), you can exclude 3 developers in order to build the commits of the 4th one. 由于您的团队很小(有4个开发人员),因此可以排除3个开发人员来构建第4个开发人员的提交。

It seems you are looking for a combination of: 您似乎正在寻找以下各项的组合:

git-show-ref

  $ git show-ref [--hash]
  528ea2bb0d2f9dbf166bcefce2aba34cf53cdf4d [refs/heads/branch]
  a3a5a0d105729c19dfea0aa09a8c8a19a9d65262 [refs/heads/master]

and: 和:

git-log

for each of the branches: 对于每个分支:

  (master)$ git log [--author|--committer]=... --pretty="%H"
  a3a5a0d105729c19dfea0aa09a8c8a19a9d65262
  18c4c551a935cfa42189fc48f83273a3290c96b0
  86fd09697424a72bbece451bc6bdab54cee61794
  d7aaab0f4d4055bc541284b723edb111c55b3e95

  (branch)$ git log [--author|--committer]=... --pretty="%H"
  528ea2bb0d2f9dbf166bcefce2aba34cf53cdf4d
  d7aaab0f4d4055bc541284b723edb111c55b3e95

And, tadaaa, here's git-reflog : 而且,tadaaa,这是git-reflog

(master)$ git reflog [--author|--committer]=... --pretty="%H [%gd]" --branches -<no of branches>
a3a5a0d105729c19dfea0aa09a8c8a19a9d65262 [master@{0}]
528ea2bb0d2f9dbf166bcefce2aba34cf53cdf4d [branch@{0}]

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

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