首页 > 其他分享 >gerrit access control

gerrit access control

时间:2024-01-29 23:46:54浏览次数:19  
标签:control project git heads refs gerrit Gerrit access

Special and magic references

https://vlab.noaa.gov/code-review/Documentation/access-control.html#references

The reference namespaces used in git are generally two, one for branches and one for tags:

  • refs/heads/*

  • refs/tags/*

However, every reference under refs/* is really available, and in Gerrit this opportunity for giving other refs a special meaning is used. In Gerrit they are sometimes used as magic/virtual references that give the push to Gerrit a special meaning.

 

refs/for/<branch ref>

Most prominent is the refs/for/<branch ref> reference which is the reference upon which we build the code review intercept before submitting a commit to the branch it’s uploaded to.

Examples of typical roles in a project

https://gerrit.int.com/Documentation/access-control.html#example_roles

Below follows a set of typical roles on a server and which access rights these roles typically should be granted. You may see them as general guidelines for a typical way to set up your project on a brand new Gerrit instance.

Contributor

This is the typical user on a public server. They are able to read your project and upload new changes to it. They are able to give feedback on other changes as well, but are unable to block or approve any changes.

Suggested access rights to grant:

  • Read on 'refs/heads/\*'

  • Push to 'refs/for/refs/heads/*'

  • Code-Review with range '-1' to '+1' for 'refs/heads/*'

If it’s desired to have the possibility to upload temporarily hidden changes there’s a specific permission for that. This enables someone to add specific reviewers for early feedback before making the change publicly visible.

Developer

This is the typical core developer on a public server. They are able to read the project, upload changes to a branch. They are allowed to push merge commits to merge branches together. Also, they are allowed to forge author identity, thus handling commits belonging to others than themselves, effectively allowing them to transfer commits between different branches.

They are furthermore able to code review and verify commits, and eventually submit them. If you have an automated CI system that builds all uploaded patch sets you might want to skip the verification rights for the developer and let the CI system do that exclusively.

Suggested access rights to grant:

If the project is small or the developers are seasoned it might make sense to give them the freedom to push commits directly to a branch.

Optional access rights to grant:

Project Owner Guide

https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.3/intro-project-owner.html#project-owner

This is a Gerrit guide that is dedicated to project owners. It explains the many possibilities that Gerrit provides to customize the workflows for a project.

What is a project owner?

Being project owner means that you own a project in Gerrit. Technically this is expressed by having the Owner access right on refs/* on that project. As project owner you have the permission to edit the access control list and the project settings of the project. It also means that you should get familiar with these settings so that you can adapt them to the needs of your project.

Being project owner means being responsible for the administration of a project. This requires having a deeper knowledge of Gerrit than the average user. Normally per team there should be 2 to 3 persons, who have a certain level of Git/Gerrit knowledge, assigned as project owners. It normally doesn’t make sense that everyone in a team is project owner. For normal team members it is sufficient to be committer or contributor.

Here is the flow of gerrit code review.

https://haiyanghaiyang.gitbooks.io/gerrit-user-manual/content/ti-jiao-dai-ma-ping-shen/code-review-flow.html

  • Engineer commit change list in local git and push to gerrit for review.

    $git add file

    $git commit -m "message"

    $git push origin HEAD:refs/for/<branch name>

    Engineer should add reviewers one by one to review the CL.

  • When code in review, engineer can amend the CL and push that into gerrit again as patch set 2, 3 etc.

    $git add file

    $git commit --amend

    $git push origin HEAD:refs/for/<branch name>

https://blog.7v1.net/development/gerrit-workflow.html

Gerrit 中采用了虚拟分支来实现一些特性,如:push 到 refs/for/* 分支视为提交一次 Patchset,refs/changes/10/1010/1 用于下载已经提交的 Patchset 代码。一般情况下,如果只围绕这 master 分支开发的话,可以不需要任何其他分支。

非分支开发
  1. 使用远端的 master 分支代码覆盖本地代码:git fetch origin master && git checkout FETCH_HEAD

  2. 在此基础上进行开发,开发完成后提交 Patchset:git push origin HEAD:refs/for/master

  3. Review 未通过,被打回重新修改:git fetch origin refs/changes/<change-id> && git checkout FETCH_HEAD

  4. 修改完成后,再次提交 Patchset:git add -u && git commit --amend --no-edit && git push origin HEAD:refs/for/master

  5. Review 通过,合并到 master 分支;

  6. 开发下一个特性,重复上述步骤;

但是,如果碰到很多的大型的特性,一个 Change 无法完成,那就不得不启用分支开发了,所以分支模型对于 Gerrit Workflow 来讲也是需要的。

 

标签:control,project,git,heads,refs,gerrit,Gerrit,access
From: https://www.cnblogs.com/lightsong/p/17995613

相关文章

  • ControlNet学习实战1--字体海报
    最近玩AI绘画的过程中,突然发现了一个可以生成特点字体海报的技巧,特此记录学习一下。本片文章介绍大家制作一张2024龙年海报。ControlNet介绍ControlNet是一个应用于Stable_diffusion一个插件,该插件可以让AI更加精准的生成准确的想要的图片,关于这些内容后期会专门更加细致的说明......
  • 【SpringBoot】当AOP引发的异常与@RestControllerAdvice擦肩而过:异常处理的盲点揭秘
    各位上午/下午/晚上好呀!今天在写bug的时候发现一个这样的问题:AOP抛出的异常竟然没有被@RestControllerAdvice注解修饰的异常统一处理类处理。 需求是这样子滴:对某些加了自定义注解的方法进行切面处理,通过条件判断是否有权限执行该方法。伪代码大概长这个样子:@Around(......
  • 虚拟机vmware安装ubuntu磁盘塞满启动爆ubuntu 开机报错 piix4_smbus : SMBus Host Con
    虚拟机vmware安装ubuntu磁盘塞满启动爆ubuntu开机报错piix4_smbus:SMBusHostControllernotenabled错误解决办法  一、vmware硬件增加磁盘空间该虚拟机名称右键[设置]-虚拟机设置-【硬盘(SCSI)】-磁盘实用工具-扩展磁盘容量-【扩展】-增大适当的容量。二、重启VMWA......
  • 在springboot中controller控制器的crud语句@RequestBody遗落的报错
    在进行java练习的过程中,对一个单链表进行增删改查时发现了如下错误:对编译器的控制台进行检查之后,发现了报错语句如下:2024-01-2619:43:52.551ERROR18544---[p-nio-80-exec-5]o.a.c.c.C.[.[.[/].[dispatcherServlet]:Servlet.service()forservlet[dispatcherSe......
  • 解决 fatal: unable to access 'https://github.com/alibaba/nacos.git/': Failed to
    直接打开这个网站:https://sites.ipaddress.com/github.com/。找到网站中的IP地址复制出里面的IPAddress并粘贴到hosts里面。以下是macos上使用命令行打开方式,也可以直接在硬盘上找到这个文件打开sudovim/private/etc/hosts在最后一行添加如下代码140.82.113.4githu......
  • 五、kubernetes 核心技术-Controller
    使用deployment部署应用(yaml)kubectlcreatedeploymentweb--image=nginx--dry-run-oyaml>web.yamlvimweb.yaml根据web.yaml创建deploymentkubectlapply-fweb.yaml查看应用kubectlgetpods对外发布(暴露对外端口号)kubectlexposedeploymentweb--p......
  • 2024年1月Java项目开发指南5:controller、service、mapper
    准备工作你知道什么是JSON吗?JSON是什么?格式是什么?有什么用?有什么优点?有什么缺点?请自己百度探索一下,对JSON做了个了解,如果你不知道什么是JSON的话,知道就免了,直接下一步吧。开始:项目目录结构先确保你已经创建了上图的那些文件夹。这都是我们需要用到。简单的做个介绍co......
  • 获取AccessToken
    百度AI开放平台通用鉴权认证机制一、获取APIKey/SecretKey关键信息主要为AppID、APIKey、SecretKey注:更新SecretKey后历史生成的Access_token将立即失效二、获取Access_tokenhttps://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=Va5yQR......
  • Permission denied: user=hive, access=EXECUTE, inode=“/tmp“:root:supergroup:drw
    在执行Hadoop的创建目录、写数据等情况,可能会出现该异常,而在读文件的时候却不会报错,这主要是由于系统的用户名不同导致的,由于我们进行实际开发的时候都是用Windows操作系统,而编译后的JAVA程序是部署在Linux上的。而Windows的用户名一般都是自定义的或者是administrator,Linux的用户......
  • MapStruct+Maven+Lombok问题NoSuchBeanDefinitionException、does not have an access
    概述先直接说我遇到的问题吧,SpringBoot应用启动失败:ERROR|org.springframework.boot.web.embedded.tomcat.TomcatStarter|onStartup|61|-ErrorstartingTomcatcontext.Exception:org.springframework.beans.factory.UnsatisfiedDependencyException.Message:Er......