简体   繁体   English

如何使用 gitlab、jenkins、git 设置代码审查工作流?

[英]How to set up a code review workflow using gitlab,jenkins,git?

So my question is that i want to set up a code review flow , the tools i have are : git,gitlab,jenkins.. my idea is like to have a kind of forms or checklists that a member of the team need to fill whenever other member want to merge some new code , if the checklist are filled correctly and the new code is approved by the reviewer then the code should be merge, else the merge request is refused.所以我的问题是我想建立一个代码审查流程,我拥有的工具是:git,gitlab,jenkins .. 我的想法是拥有一种团队成员需要在任何时候填写的表格或清单其他成员想要合并一些新代码,如果检查表填写正确并且新代码被审阅者批准,则应该合并代码,否则合并请求被拒绝。

does everyone have an idea how i can achieve this?每个人都知道我如何实现这一目标吗? or maybe have a better idea than having a checklist?或者也许有比清单更好的主意?

thank you all,谢谢你们,

Best regards此致

You can use GitLab CI, is like Jenkins, and he can pass the test,compile and do the tasks what you want before the merge.你可以使用 GitLab CI,就像 Jenkins 一样,他可以在合并之前通过测试、编译和做你想做的任务。 In Gitlab you have automerge, that is completed when you configure.在 Gitlab 中,您有自动合并,这在您配置时完成。 ( https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html ) https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html

With GitLab 13.7 (December 2020), you don't need a third-party tool like Gerrit.使用GitLab 13.7 (2020 年 12 月),您不需要像 Gerrit 这样的第三方工具。

You now have officially merge-request reviewers:您现在拥有正式的合并请求审阅者:

Reviewers for Merge Requests合并请求的审阅者

Asking a colleague to review your code should be a routine part of contributing code, but it's often needlessly complex.请同事审查您的代码应该是贡献代码的常规部分,但它通常是不必要的复杂。

A simple task like asking for a review can lead to confusion.像要求评论这样的简单任务可能会导致混淆。 For example, how should you ask?例如,你应该怎么问? An email?一封电邮? Comment?评论? Chat message?聊天消息?

Without a formal process, reviews can be inconsistent and hard to keep track of.如果没有正式的流程,审核可能会不一致且难以跟踪。 Previously, an option was to assign a reviewer to a merge request, but even with this formality, both the author and the reviewer appeared in the same assignee field, making it hard for other team members to know who was doing what.以前,一个选项是为合并请求指定一个审阅者,但即使采用这种形式,作者和审阅者都出现在同一个受让人字段中,这使得其他团队成员很难知道谁在做什么。

GitLab 13.7 introduces reviewers for merge requests, which allows authors to request a review from someone. GitLab 13.7 为合并请求引入了审阅者,允许作者向某人请求审阅。
The new “Reviewers” field allows users to be designated as reviewers in a similar way to assignees.新的“审阅者”字段允许以与受让人类似的方式将用户指定为审阅者。 The reviewers receive a notification inviting them to review the merge request.审查者会收到通知,邀请他们审查合并请求。

This provides a formal process for requesting a review and clarifies the roles of each user in a merge request.这为请求审查提供了正式流程,并阐明了合并请求中每个用户的角色。

Future iterations will include showing the most relevant reviewers for a merge request as well as a streamlined merge request approval flow that puts reviewers at the center.未来的迭代将包括显示与合并请求最相关的审阅者以及将审阅者置于中心的简化合并请求批准流程。
You can follow along in the merge request reviewer assignment epic for more details.您可以在合并请求审阅者分配史诗中了解更多详细信息。

https://about.gitlab.com/images/13_7/reviewers_sidebar.png -- 合并请求的审阅者

See Documentation and Issue .请参阅文档问题

And the same GitLab 13.7 (December 2020) facilitates that review process with:同样的GitLab 13.7 (2020 年 12 月)通过以下方式促进了审查过程:

Choose to show one file at a time directly from merge requests直接从合并请求中选择一次显示一个文件

Merge request reviews are an essential task to ensure quality code from contributors, as this is where most of the communication between author and reviewer takes place.合并请求审查是确保来自贡献者的代码质量的一项基本任务,因为这是作者和审查者之间大部分交流的地方。 However, as merge requests become larger and more files are involved, navigation and performance of merge request diffs can become difficult.但是,随着合并请求变得更大并且涉及更多文件,合并请求差异的导航和性能可能变得困难。

GitLab 13.7 introduces the option to show one file at a time in the merge request view. GitLab 13.7 引入了在合并请求视图中一次显示一个文件的选项。 As you navigate to the Changes tab of the merge request, click the gear icon and check the box labeled Show one file at a time .当您导航到合并请求的更改选项卡时,单击齿轮图标并选中标记为一次显示一个文件的框。 This will display a single file at a time and enable the Prev and Next buttons to navigate among files.这将一次显示一个文件,并启用PrevNext按钮在文件之间导航。

Single file mode provides a cleaner workspace and enhances the reviewer focus on a single file, while improving the performance and navigation of the merge request diff.单文件模式提供了更干净的工作区并增强了审阅者对单个文件的关注,同时提高了合并请求差异的性能和导航。

https://about.gitlab.com/images/13_7/singlefile-mode.png -- 直接从合并请求中选择一次显示一个文件

See Documentation and Issue .请参阅文档问题

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

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