什么是源代码控制和配置管理最佳实践?

时间:2021-11-14 20:02:40

I am thinking of a list that I could refer other developers to with things like:

我正在考虑一个列表,我可以推荐其他开发人员使用以下内容:

  1. One build script, such as makefile, will build and test entire project
  2. 一个构建脚本(如makefile)将构建并测试整个项目

  3. All components to needed build the system need to be source controlled
  4. 构建系统所需的所有组件都需要源控制

Anybody have such a list? In priority order?

有谁有这样的名单?优先顺序?


UPDATE - added some fyi detail

更新 - 添加了一些fyi细节

System in question consists of C++ and makefiles, Java with ant that results in WARs, as well as powerbuilder and C# gui components. All code is in perforce.

有问题的系统包括C ++和makefile,带有ant的导致WAR的Java,以及powerbuilder和C#gui组件。所有代码都在perforce中。

So I am looking for both generic as well as language specific best practices.

所以我正在寻找通用和语言特定的最佳实践。

8 个解决方案

#1


To me, the #1 rule is this:

对我来说,#1规则是这样的:

The main branch is sacred - it must always be buildable, capable of passing BVT's, and be basically usable.

主要分支是神圣的 - 它必须始终是可构建的,能够通过BVT,并且基本上可用。

Any code that is allowed to go into the main branch that causes a build or BVT break exposes a bug in the process. The process should allow buddy builds/tests for single branch systems, or require child branches to build and pass BVT's before mergining into the main branch, or other such safeguards.

任何允许进入主分支导致构建或BVT中断的代码都会暴露流程中的错误。该过程应该允许单个分支系统的伙伴构建/测试,或者需要子分支在合并到主分支或其他此类安全措施之前构建并传递BVT。

#2


Take a look at High-level Best Practices in Software Configuration Management.

查看软件配置管理中的高级最佳实践。

#3


This is highly dependent on what environment are you building in?

这在很大程度上取决于你建立的环境?

  • Is it C/MakeFile?
  • 是C / MakeFile吗?

  • Is it Java/JUnit/Ant?
  • 是Java / JUnit / Ant吗?

  • Is it .NET/NUnit/NAnt?
  • 是.NET / NUnit / NAnt吗?

  • Is it .NET/MSUnit/MSBuild?
  • 是.NET / MSUnit / MSBuild吗?

  • Is it Ruby...
  • 是Ruby吗?

  • Is it Python...
  • 是Python吗?

  • Is it PHP
  • 是PHP吗?

Each of these differ in approach and setup. So we need to know your setup before you can be helped.

这些方法和设置各不相同。因此,在您获得帮助之前,我们需要了解您的设置。

#4


My number one item:

我的头号项目:

  • Update often, commit often,
  • 经常更新,经常提交,

or, as Jeff puts is: Check In Early, Check In Often.

或者,正如Jeff所说:早期入住,经常入住。

#5


The system must build by itself, test by itself, and download+build dependencies by itself. I have a makefile downloading, building and deploying a runtime environment which is "certified" for my trunk version. This makefile is committed as well into the repository.

系统必须自行构建,自行测试,并自行下载+构建依赖项。我有一个makefile下载,构建和部署一个运行时环境,该环境已经过我的trunk版本的“认证”。此makefile也会提交到存储库中。

Remember to commit another, very important, and mostly overlooked thing (comes in a bundle of three):

记住提交另一个,非常重要且被忽视的事情(以一捆三个):

  • The SQL code that creates your database layout (put a version on it!).
  • 创建数据库布局的SQL代码(在其上放置一个版本!)。

  • The SQL code that brings up your database layout version (to upgrade)
  • 调出数据库布局版本的SQL代码(升级)

  • The SQL code that bring down your database layout version (to downgrade)
  • 降低数据库布局版本的SQL代码(降级)

#6


If you pass those questions from the "Joel Test", you should be on the right path:

如果你从“乔尔测试”中传递这些问题,你应该走在正确的道路上:

Do you use source control?
Do you make daily builds?
Do you have a bug database?
Do you fix bugs before writing new code?

你使用源代码控制吗?你做日常构建吗?你有一个bug数据库吗?你在编写新代码之前修复了错误吗?

My #1 is : Can you make a build in one step?

我的#1是:你能一步完成构建吗?

The Joel Test

乔尔测试

#7


The whole process of "getting the latest" and "building" should be smooth, easy ,fast and reliable.

“获得最新”和“建设”的整个过程应该是顺利,简单,快速和可靠的。

If not- developers tend to skip getting the latest and keep on working on their stale copies and that is something you want to avoid.

如果不是 - 开发人员倾向于跳过最新的并继续处理他们陈旧的副本,这是你想要避免的。

This is more or less what Michael said- but I want to stress that beyond the branch being sacred and stable- the whole process should be quick and easy

这或多或少是迈克尔所说的 - 但我想要强调的是,超越分支的神圣和稳定 - 整个过程应该快速而简单

Kinda like Google's philosophy that downloads\installations should be quick and easy

有点像谷歌的下载\安装应该快速而简单的理念

#8


Being an SCM manager, the best answer that I can give you on this question is "it depends". Your list and order of importance of items on the list will depend on your project requirements, language you are using, and developer level.

作为SCM经理,我能在这个问题上给你的最佳答案是“它取决于”。列表中项目的重要性列表和顺序取决于项目要求,使用的语言和开发人员级别。

One thing that you may want to consider to me important (or #1) on ANY list you put together is that the trunk or primary branch of your tool be VERY heavily controlled and only a very select few have access to import or commit changes to it. This will save a ton of headaches at release time.

您可能想要考虑的重要事项(或#1)在您放在一起的任何列表上都是您的工具的主干或主分支非常严格控制,只有极少数人可以访问导入或提交更改它。这将在发布时节省大量的麻烦。

Items that can be on any list you put together is:

可以放在任何列表中的项目是:

  • When to check-in (daily, weekly, more often, less often)
  • 何时办理登机手续(每日,每周,更频繁,更少)

  • When builds are done (daily, weekly, etc.)
  • 构建完成后(每天,每周等)

  • Use of dual repositories (engineering vs production)
  • 使用双存储库(工程与生产)

  • Allow binaries in repository
  • 允许存储库中的二进制文件

  • Allow third party software in repository
  • 允许存储库中的第三方软件

  • All items necessary for build in repository
  • 构建存储库所需的所有项目

  • When imports or commits to trunk are done
  • 当进口或提交到主干时

  • Use one file to export and build
  • 使用一个文件导出和构建

  • Allow check-in with/without bug report information
  • 允许办理登机手续,有/无错误报告信息

  • Enforce check-in comment standards
  • 实施签到评论标准

The list can go on and on depending on your specific requirements, but I think you get the general idea with what's here.

列表可以根据您的具体要求不断进行,但我认为您可以了解这里的内容。

#1


To me, the #1 rule is this:

对我来说,#1规则是这样的:

The main branch is sacred - it must always be buildable, capable of passing BVT's, and be basically usable.

主要分支是神圣的 - 它必须始终是可构建的,能够通过BVT,并且基本上可用。

Any code that is allowed to go into the main branch that causes a build or BVT break exposes a bug in the process. The process should allow buddy builds/tests for single branch systems, or require child branches to build and pass BVT's before mergining into the main branch, or other such safeguards.

任何允许进入主分支导致构建或BVT中断的代码都会暴露流程中的错误。该过程应该允许单个分支系统的伙伴构建/测试,或者需要子分支在合并到主分支或其他此类安全措施之前构建并传递BVT。

#2


Take a look at High-level Best Practices in Software Configuration Management.

查看软件配置管理中的高级最佳实践。

#3


This is highly dependent on what environment are you building in?

这在很大程度上取决于你建立的环境?

  • Is it C/MakeFile?
  • 是C / MakeFile吗?

  • Is it Java/JUnit/Ant?
  • 是Java / JUnit / Ant吗?

  • Is it .NET/NUnit/NAnt?
  • 是.NET / NUnit / NAnt吗?

  • Is it .NET/MSUnit/MSBuild?
  • 是.NET / MSUnit / MSBuild吗?

  • Is it Ruby...
  • 是Ruby吗?

  • Is it Python...
  • 是Python吗?

  • Is it PHP
  • 是PHP吗?

Each of these differ in approach and setup. So we need to know your setup before you can be helped.

这些方法和设置各不相同。因此,在您获得帮助之前,我们需要了解您的设置。

#4


My number one item:

我的头号项目:

  • Update often, commit often,
  • 经常更新,经常提交,

or, as Jeff puts is: Check In Early, Check In Often.

或者,正如Jeff所说:早期入住,经常入住。

#5


The system must build by itself, test by itself, and download+build dependencies by itself. I have a makefile downloading, building and deploying a runtime environment which is "certified" for my trunk version. This makefile is committed as well into the repository.

系统必须自行构建,自行测试,并自行下载+构建依赖项。我有一个makefile下载,构建和部署一个运行时环境,该环境已经过我的trunk版本的“认证”。此makefile也会提交到存储库中。

Remember to commit another, very important, and mostly overlooked thing (comes in a bundle of three):

记住提交另一个,非常重要且被忽视的事情(以一捆三个):

  • The SQL code that creates your database layout (put a version on it!).
  • 创建数据库布局的SQL代码(在其上放置一个版本!)。

  • The SQL code that brings up your database layout version (to upgrade)
  • 调出数据库布局版本的SQL代码(升级)

  • The SQL code that bring down your database layout version (to downgrade)
  • 降低数据库布局版本的SQL代码(降级)

#6


If you pass those questions from the "Joel Test", you should be on the right path:

如果你从“乔尔测试”中传递这些问题,你应该走在正确的道路上:

Do you use source control?
Do you make daily builds?
Do you have a bug database?
Do you fix bugs before writing new code?

你使用源代码控制吗?你做日常构建吗?你有一个bug数据库吗?你在编写新代码之前修复了错误吗?

My #1 is : Can you make a build in one step?

我的#1是:你能一步完成构建吗?

The Joel Test

乔尔测试

#7


The whole process of "getting the latest" and "building" should be smooth, easy ,fast and reliable.

“获得最新”和“建设”的整个过程应该是顺利,简单,快速和可靠的。

If not- developers tend to skip getting the latest and keep on working on their stale copies and that is something you want to avoid.

如果不是 - 开发人员倾向于跳过最新的并继续处理他们陈旧的副本,这是你想要避免的。

This is more or less what Michael said- but I want to stress that beyond the branch being sacred and stable- the whole process should be quick and easy

这或多或少是迈克尔所说的 - 但我想要强调的是,超越分支的神圣和稳定 - 整个过程应该快速而简单

Kinda like Google's philosophy that downloads\installations should be quick and easy

有点像谷歌的下载\安装应该快速而简单的理念

#8


Being an SCM manager, the best answer that I can give you on this question is "it depends". Your list and order of importance of items on the list will depend on your project requirements, language you are using, and developer level.

作为SCM经理,我能在这个问题上给你的最佳答案是“它取决于”。列表中项目的重要性列表和顺序取决于项目要求,使用的语言和开发人员级别。

One thing that you may want to consider to me important (or #1) on ANY list you put together is that the trunk or primary branch of your tool be VERY heavily controlled and only a very select few have access to import or commit changes to it. This will save a ton of headaches at release time.

您可能想要考虑的重要事项(或#1)在您放在一起的任何列表上都是您的工具的主干或主分支非常严格控制,只有极少数人可以访问导入或提交更改它。这将在发布时节省大量的麻烦。

Items that can be on any list you put together is:

可以放在任何列表中的项目是:

  • When to check-in (daily, weekly, more often, less often)
  • 何时办理登机手续(每日,每周,更频繁,更少)

  • When builds are done (daily, weekly, etc.)
  • 构建完成后(每天,每周等)

  • Use of dual repositories (engineering vs production)
  • 使用双存储库(工程与生产)

  • Allow binaries in repository
  • 允许存储库中的二进制文件

  • Allow third party software in repository
  • 允许存储库中的第三方软件

  • All items necessary for build in repository
  • 构建存储库所需的所有项目

  • When imports or commits to trunk are done
  • 当进口或提交到主干时

  • Use one file to export and build
  • 使用一个文件导出和构建

  • Allow check-in with/without bug report information
  • 允许办理登机手续,有/无错误报告信息

  • Enforce check-in comment standards
  • 实施签到评论标准

The list can go on and on depending on your specific requirements, but I think you get the general idea with what's here.

列表可以根据您的具体要求不断进行,但我认为您可以了解这里的内容。