Agility with just a few words (2)-continuous integration

Source: Internet
Author: User

In this article, I will only talk about "continuous integration ".

Some people say that Agility must have continuous integration, while others say that continuous integration is agile. If you do not know about continuous integration, check out 《Continuous IntegrationThe Chinese translation of the second edition.

The biggest benefit of continuous integration isReduce Risks, Timely discoveryCodeAnd keep the code available at any time.

If continuous integration is not used, what will happen?

1. It takes a lot of time to complete the integration, and there may be many bugs.

2. the development process will be chaotic. Developers cannot add or modify code based on stable code versions.

A good continuous integration should includeSource codeManagement system, automatic system construction, automated testing system, and automatic system deployment.

The cost of building a continuous integration environment is very low and can be achieved through some open source tools. For example, we use SVN + cruisecontrol. NET + Nant (msbuild) + xunit.

What do we need to pay attention to when using continuous integration?

First, pay attention to the results of continuous integration.

Continuous integration has two types of results: fail (red light) and pass (green light ). Especially when the red light is on, everyone in the team must be able to see it, and relevant personnel must pay attention to it and immediately stop the work at hand to fix it. I have seen some teams use a large monitor, so that the red light that is visible in the middle of the team members is easily seen by the team members, and everyone will not be happy to watch it, until you fix it. Even some teams use emails for harassment and send emails to breaker or all team members until the compilation is complete. It is said that thoughtworks uses a theme similar to a lantern, which is very vivid and interesting when integrated with the outdated lantern with two red lights.

Another simple method is to require team members to automatically start cctray when their computers are turned on (if ccnet is used). All team members can get the integration result through cctray in a timely manner.

"Whoever destroys the building will be punished", but here the "penalty" is not really a punishment, but something like asking others to drink cola. When everyone makes a mistake and forgets to import some files to the database, I still remember a colleague who failed to work because of the damage to the building, the Cola we sent after the solution was finally solved.

Second, integrate with the local machine before receiving the database.

This is a good habit. To make everyone in the team develop this habit, you must make the integration of the local machine easier, such as making a BAT file. Martin Fowler'sArticleIt is mentioned that the integration is performed twice on the local machine. The first time the Code is integrated, the second time the latest code is updated. If there is a conflict, the integration is performed once after the conflict is resolved. Then, import the data to the database.

Native integration passed, not necessarily passed on the Integration Server after submission. Generally, the building should be highlighted with a red light because the compilation on the local machine is normal, and a problem occurs on the build server. The most common cause is the leakage of the warehouse receiving file and integration with the local machine without updating the latest code.

Third, frequent integration is encouraged.

Building is generally divided into daily building, real-time building, and manual building. In my opinion, daily building is a must. If real-time building is possible, real-time building is required. When you complete a small iteration or function, you can add it to the build so that other members of the team can obtain code that is more available in a timely manner. Frequent warehouse receiving and integration can also reduce the cost of code conflicts.

I have seen some teams that use daily building and manual building. During manual building, sometimes some manual intervention is required, such as modifying a configuration file and replacing a file. In fact, this is not encouraging. Make sure that the building is automatically executed.

Fourth, accelerate integration.

I believe that any project that is slightly larger will encounter such a dilemma. It may take several hours or even longer to build the entire project. This is intolerable unless the daily build is performed in the middle of the night. If the code is submitted, it takes one hour to get the result, which is unbearable. We have encountered this problem before. Then I found a lot of ways to reduce the real-time build time. For example, you can separate different projects, compile only release during the day, compile release together with debug at night, compile the msbuild plug-in to intelligently judge the input files, and compile only the influential code projects. I have previously written an article devoted to this method (ccnet + msbuild + SVN real-time build optimization summary ).

Fifth, automatic testing.

Ccnet has a good extension mechanism to automatically execute unit test cases after code compilation. At the same time, ccnet also supports some code style check tools and code coverage tools (such as ncover ). In addition, some integration test cases also need to be automatically triggered after the build is complete. These cases usually depend on some specific environments, such as external databases, and the case execution takes a little longer. In order not to affect the automatic build time, you need to use a separate machine to trigger and execute these cases, or even build an automated Distributed Case execution platform. For example, we have implemented our own box automated testing platform.

 

Not just to be partial, but to talk about what I think. To learn more about continuous integration, take a closer look at Martin Fowler's 《Continuous IntegrationThe Chinese translation of the second edition. If you have any questions about using ccnet, you can ask me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.