Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 如何使用gerrit防止损坏的内置主控?_Git_Build_Workflow_Gerrit - Fatal编程技术网

Git 如何使用gerrit防止损坏的内置主控?

Git 如何使用gerrit防止损坏的内置主控?,git,build,workflow,gerrit,Git,Build,Workflow,Gerrit,Gerrit工作流的发明是为了在将失败引入master之前使构建通过。这可以防止大多数故障,但主控设备仍可能损坏 考虑这一点: deva引入了一个带有测试的特性1,并将其合并 Dev B引入了一个与功能1不兼容的功能2,但这样做的目的是不存在合并冲突=>merged devc发现主版本已损坏 如何防止这种情况发生 这是一个时间表: master .-> feature 1 with a test1 => build passing .-> feature 2 tha

Gerrit工作流的发明是为了在将失败引入master之前使构建通过。这可以防止大多数故障,但主控设备仍可能损坏

考虑这一点:

  • deva引入了一个带有测试的特性1,并将其合并
  • Dev B引入了一个与功能1不兼容的功能2,但这样做的目的是不存在合并冲突=>merged
  • devc发现主版本已损坏
如何防止这种情况发生

这是一个时间表:

master
  .-> feature 1 with a test1 => build passing
  .-> feature 2 that causes test1 to fail => build passing because there is no dependency on feature 1
  |
<-. merge feature 1
<-. merge feature 2 => no conflicts
  . master is broken
在功能1中添加了测试:

# file: test_code.js
function test_code() {
  assert(test_code() == true);
}
在功能2中添加了测试:

# file: code.js
function code() {
  return true;
}
# file: test_feature.js
function test_feature() {
  assert(test_code() == false);
}
# file: code.js
function code() {
  return false;
}
功能2中的代码已更改:

# file: code.js
function code() {
  return true;
}
# file: test_feature.js
function test_feature() {
  assert(test_code() == false);
}
# file: code.js
function code() {
  return false;
}

正如您所看到的,如果Dev B正在进行合并,则没有冲突。

。他们有责任运行测试并确保测试仍然通过


当使用经典的Gerrit工作流(即Gerrit进行合并)时,我非常确定Gerrit会要求您在合并之前重新确定更改的基础;在这种情况下,我所记得的只是当发生冲突时,我需要在本地执行重基,但在这种情况下,如果测试失败,我不知怎么地忘记了运行它们,Jenkins会拿起它,对我的重基更改运行测试,并立即用-1(已验证)标记我的CL。

你能举个例子吗?因为我无法想象。。“功能1有测试”是什么意思?另外,请添加功能从审阅提交给master并推送到已审阅提交时间表的时间。@HiB这只是一个有一些测试的功能。功能2是导致功能1失败的功能。未能捕获失败,因为功能1在功能2审查时尚未在master上。>Gerrit将要求您在合并更改之前重新设置更改的基础;<不总是这样。只有当发生冲突时。我说的是没有冲突的情况。