Practices of agile development and continuous integration ..... Text transfer (please support original author)

Source: Internet
Author: User
Tags continuous integration tools


This article summarizes the use of CruiseControl over the past year. net to continue the work flow integration experience, detailed descriptions of installation, configuration, use of CruiseControl. to understand and master the use of CruiseControl. net basic usage skills, use tools to improve workflows and improve work efficiency.

What is continuous integration?

First, let's first figure out what is continuous integration? How does it help our daily work? In the past few years, agile has become a very popular topic. It has won the attention of many small and medium software vendors for its efficient working methods and quick response to demands. In addition to some programming thinking and iterative development modes, agile depends on tools to improve workflow. Continuous integration tools are a series of services for agile software development. It mainly organizes originally scattered and unordered workflows and organically organizes them through tools and software, employees from various departments involved in the development, design, and testing can enjoy discounts on automation. This greatly improves the efficiency of the team.

What is cruisecontrol. Net?

What is continuous integration as described above, CruiseControl. Net is a lightweight continuous integration tool provided to us by ThoughtWorks. It organically organizes work steps such as code version control, unit test, code specification check, and project release and deployment, and can be automatically processed by scheduling, it also has a powerful logging function, which can feedback the integration results to the project management personnel and project developers in a timely manner. In the following sections, all the use of CruiseControl. Net is replaced by CC. Net. The following is the workflow of CC. Net.

How to install cc. net

CC. Net is an open-source software. Its official homepage is:


Open its home page and you will be able to see that its official use of another outstanding team collaboration platform Confluence, which is combined with the jira Bug Management System, can also greatly improve the team collaboration capability, for their introduction, visit: /. Okay, return to continue introducing CC. net, the latest CruiseControl has been officially released. NET- In the release column of the home page, you can find the latest version of CC. net connection, it is an open source software, you can also find its source code and installation files in the If you want to use CC. Net to directly download the exe file. After the download, the local installation process is as follows:

1. Double-click the program and open the software installation interface, as shown in the following figure:

2. Click Next, select the software installation path, and wait until the software installation is complete. The interface is as follows:

3. After the software is installed, the system service named CruiseControl. Net Server will be added to the system windows service, as shown below:

Note that the service is not started by default.

Because CC. net is an integrated continuous tool in the deployment of CC. net, it has no practical significance to independently rely on it, so you can configure CC in deployment. net, you need to prepare and install the following software in advance:

1. Code version management tools such as VSS
2. Code build tool. If you are a user, we strongly recommend that you do not use Nant. It is difficult to configure it. We recommend you use msbuild as the build tool. Msbuild is installed with. NET Framework 2.0. You must install. NET Framework 2.0 or later on the CC. NET Server.
3.code audit tool, .netusers recommended use fxcop.exe,: Familyid = 3389f7e4-0e55-4a4d-bc74-4aeabb17997b & displaylang = EN, unfortunately it's the original official homepage
Disabled. I did not find it in the new site.
4. Unit Test Tool: nunit, official homepage:
5. release the deployment tool. For the website, you can use ASP. net compilation tool (aspnet_compiler.exe), but I feel it is not easy to use, so I have implemented a series of code releases, FTP uploads, xcopy installation and other components, which will be mentioned later.

In addition to the above, CC. Net also supports ncover, Simian and fitness. I don't have specific applications, so I will not talk about it much.

How to configure and deploy

Assuming that the above tools have been successfully installed, we will use a project to demonstrate how to implement automated building, unit testing, code specification detection, and automatic release and deployment. In addition, it can demonstrate the methods used by project management and developers to learn about the continuous integration results in a timely manner.

Before demonstration and production, let's take a look at the current continuous integration environment.

First, we create the solution Jillzhang. DailyBuild for demonstration, which includes four projects:

After creating a solution, add it to the VSS project manager. The hierarchy is as follows:

Next, let's take a look at how to configure CC. Net to make it work.

1. On the CC. Net Server, click the Start menu and select CruiseControl. Net from all programs to open the CruiseControl. NET Config configuration file.

2. CC.. Net supports monitoring and integration of multiple solutions at the same time. net is called a Project ., in CruiseControl. in. NET Config, a Project is described by a <project> element. Of course, we also need to specify the name and working directory and log storage directory for each Project. Read the CC. Net documentation to learn about some attributes and child elements of the <project> element. Here I will only talk about some of the things I use.
Name, for example, <project name = "Project1"> indicates a new project named Project1. This name will be displayed as the project ID to the user who views the report in the future. For example, it is displayed on cctray or on the website doashboard. Another important sub-element <workingDirectory> is very similar to <baseAddress> In the WCF configuration. It is used to indicate the working directory of the project, that is, the root directory for downloading files from the version manager. In addition, we also need to set the sub-element <artifactDirectory> to indicate the location where log records are saved. CC. Net provides several version management methods for us. You can use <labeler> to specify which type of version labels to use, such as Date.
Labeller, Default Labeller, etc. For details, refer to the documentation. We use Date Laberller here, so set it to <labeler type = "dateLabeller"/>. You can set the source code manager below. CC. Net supports most mainstream version control tools, such as CVS, VSS, Rational ClearCase, VSTS, and Alienbrain. We use VSS here. According to the above VSS and solution configuration, we set it here:

Set autoGetSource to true. CC. Net automatically obtains the source code from the version manager by monitoring the version changes of the Code in VSS. Project is the path of the solution to be used in vss. The value is as follows:

Username is the user name for access to vss, and password is the password for access to vss. Ssdir is the shared path of the vss code base. Here is \ \ vss \. If cleanCopy is set to true, CC. Net checks whether to completely overwrite the updated file every time it obtains the latest file.

Currently, our configuration file is:

After setting VSS, we can start CC.. Net. Open Services as follows. msc, find the CruismControl. before starting the Net Server service, you need to solve the problem that may affect your mood most: We know that windows services runs with a local system account by default, generally, the access permission to the vss shared directory is set under the current user. For example, the current windows running account is administrator, in administrator, we can use net use to set access to \ \ vss \.
Safe Client opens the code library, but this is often a smoke bomb when we are in CC. when the system service account tries to use a service to access \ \ vss \, the system service account does not establish a session with the shared directory, so access to \ \ vss \ is denied \, no access permissions, not to mention getting code. Therefore, you must set the service running account before starting the service:


Only in this way can we do the following:

Start the CruismControl. Net Server Service, check out the service again, and embed the solution. After a while, we will see the automatically obtained file in the working directory E: \ DailyBuild. It is worth noting that the best thing in the log directory is to create buildlogs first. If you encounter an error when starting the CrusimControl. Net Server service, for example, it always appears at startup:

It is very likely that the above configuration is incorrect. You can determine the problem of the service in the following two ways:

1. Follow the prompts to view errors in the event viewer, such:

2. You can also find the ccnet. log file in the application directory of the CrusimControl. Net Server, which contains the detailed operation steps of CC. Net.

If no startup error occurs and. there are no obvious exceptions in the log. You can open the monitoring website to view the integration results. The addresses of the monitoring website are completed by setting the webURL attribute on the <project> element. We open this website,


When the Last Build Status is Success, the Project Integration is successful. Click the project name to view the specific integration results:


If MsBuild is called to generate code, FxCop is called to perform code specification check, and NUnit test integration is called, CC. Net needs to be configured in the next step.

The Code Standard checkside tool FxCop cannot be directly used by CC. Net. It must be appended to the command line of MsBuild. Exe. For details about how to use MSBuild, refer to msdn. For this reason, we create a Task for generating and checking code specifications. CC. Net supports custom tasks by using Executable tasks in tasks.

First, create a DailyBuild. msbuild file for msbuild parameters in the working directory. The file content is as follows:

This msbuild.exe will call the exeu. bat file in the working directory after the msbuild.exe is generated. The exeu. bat file is about using the FxCop method. The content is as follows:

The purpose is to call the fxcopcmd command line tool under the fxcop installation directory to perform a normative check on the specified assembly. In the above Code, E: \ dailybuild \ jillzhang. dailybuild. fxcop is a previously generated fxcop project file. You can open the fxcop visual interface, add a target, and save it as a location,


And save it to E: \ dailybuild \ jillzhang. dailybuild. fxcop.

Add the configuration that can generate code and detect code standardization as follows:

Note that buildtimeoutseconds is the time-out time for generating operations, and it is best to set/P: configuration = release, because this will facilitate future release. Merge combines the logs generated in the preceding tasks.

Next, re-check the embed and observe the integration results:


We can see that release is successful.

Next let's take a look at the generated dailybuild. fxcop. XML,

Open the content to see the code detection results.

To view the original text, click: original text path

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: 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.