简体   繁体   English

持续集成构建系统中有关源代码管理中标记的策略

[英]Strategy regarding tagging in source control from the continuous integration build systems

This is a question about how we should use tagging from the continuous integration system. 这是一个关于如何使用持续集成系统中标记的问题。

Clearly, the build system will try to build for most commits, skipping some of them if they are too close one to another, giving a build number for each of them. 显然,构建系统将尝试针对大多数提交进行构建,如果它们之间的距离太近,则跳过其中一些提交,并为每个提交提供一个构建号。

The result of the build can be one of the following: * build-system-failure (not enough disk space on build machine or similar) * build-failure * test-failure * success 构建的结果可能是以下之一:*构建系统故障(构建计算机或类似机器上没有足够的磁盘空间)*构建故障*测试失败*成功

Now the big question is if it would be a good idea or not to store this information inside the SCM (usually git or mercurial). 现在最大的问题是将这些信息存储在SCM中(通常是git或mercurial)是否是一个好主意。

Using tags to mark these seem like a nice idea, allowing you do do things like: 使用标记来标记这些标记似乎是一个好主意,可让您执行以下操作:

  1. record a tag build=1234 on the revision 在修订版上记录标记build=1234
  2. move the tag last-success to the current build if is a success 如果last-success ,将标签last-success移动到当前版本
  3. move the tag last-build to the last build (that did not pass the tests) 将标记last-build移至最后一个构建(未通过测试)
  4. add a tag build_url=http://buildsystem.example.com/job/1234 添加标签build_url=http://buildsystem.example.com/job/1234
  5. maybe other changes? 也许其他变化?

Now I am also wondering about spamming the SCM history with tag updates from the build system. 现在,我还想知道如何使用构建系统中的标记更新来向SCM历史记录发送垃圾邮件。

Is this the proper approach? 这是正确的方法吗? -- I do still have some concerns regarding putting too much information into the SCM and having too many email notifications as a side effect. -我仍然担心将太多的信息放入SCM中,并且有太多的电子邮件通知作为副作用。

Essentially this looks like it boils down to making sure you can trace from a given build back to the source code that created it (and vice versa) - I have seen two general approaches to solving this 从本质上讲,这似乎可以归结为确保您可以从给定的构建追溯到创建它的源代码(反之亦然)-我已经看到了两种解决此问题的通用方法

  1. The solution you mention - mark the code in the SCM with the build number (with tagging being the obvious way to do this) 您提到的解决方案-在SCM中用内部版本号标记代码(使用标记显然是这样做的方法)
  2. The opposite - store the revision number from the SCM inside the package produced by your build (for example have the build spit out a small text file containing the SCM revision number that gets included in the package). 相反-将SCM的修订号存储在由您生成的程序包内(例如,让该程序吐出一个小的文本文件,其中包含包含在程序包中的SCM修订号)。

I would say that both of these solutions work quite well, and the best one to use depends on how you intend to use this information. 我要说的是,这两种解决方案都可以很好地工作,最好的解决方案取决于您打算如何使用这些信息。 For example, if your motivation is that, when debugging an issue on a production system, you can easily check out the relevant source code for that software version, then approach (2) works well as it is easy to look up the SCM revision number on your production system and check out the code for that revision. 例如,如果您的动机是,在生产系统上调试问题时,可以轻松签出该软件版本的相关源代码,则方法(2)很好用,因为它很容易查找SCM修订版号。在您的生产系统上,并查看该修订版的代码。 However, you also have a number of good reasons for preferring option (1) listed in your question, so I would go with that. 但是,您也有很多理由偏爱您的问题中列出的选项(1),因此我同意。

To your point about controlling email spam - personally have never found a good way of stopping build systems from being spammy, I think the best strategy is to make it easy for people to filter this out if required (ie subject headers that can be used in email rules, or sending all mail to a shared email address specifically for build spam). 就您控制电子邮件垃圾邮件的观点而言,-我个人从未找到阻止构建系统成为垃圾邮件的好方法,我认为最好的策略是使人们可以轻松地根据需要将其过滤掉(例如,可以在电子邮件规则,或将所有邮件发送到专门用于垃圾邮件的共享电子邮件地址)。 Sorry I don't have a more useful suggestion. 抱歉,我没有更有用的建议。

Kudos for making your builds traceable back to the source code! 使您的构建可追溯到源代码的荣誉!

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

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