Use cruise and mercurial for personal pre-submission, improving production efficiency and overall automated test success rate

Source: Internet
Author: User
Tags mercurial

What is personal pre-commit )?

To put it simply, before submitting code, the developer must first run the build and test code locally to ensure that no test fails locally, then, submit it to the central code repository.

What is the pain point of personal build?

"Before submitting code, you must run locally and pass unit tests" is one of the principles of agile teams. With the increase of new functions, more and more unit tests are available, and the running time is of course longer and longer, so developers will wait for a long time.

Therefore, as in infoq
An article on continuous integration practices
Institute
We have installed a virtual machine on each pairstation to run the unit test we submitted. However, each virtual machine runs its own unit test, that is, during the running time
There is no major improvement. It may take about thirty minutes (because it is still running on one machine). The advantage is that developers can continue their work while performing local unit tests, however, the local unit test
The trial time has not been shortened, and the problem of long feedback time still exists. How can this problem be solved?
Install a new cruise on a machine
And a cruise agent is installed on the Virtual Machine of pairstation.
To connect it to the cruise, which becomes a personal continuous Integration Server.

In addition, cruise r1.3, which has not yet been released
Is: Multiple agents can run on the same machine. Therefore, four agents are started at the same time on the personalbuild server with the cruiseserver. If you build a continuous Integration Server, at least eight agents can work at the same time. 1.

Figure 1
Because the team uses mercurial
(Distributed version control server), so the preparation for developers is: (1) clone a local repository on their own machine, run Hg serve to start the HTTP service of the repository. (2)
In personalbuild
Server, and the materials of the pipeline points to the new repository. And only
One stage, and the test-load-balancer is used to divide the unit test into multiple jobs and add them to the stage. In this way, the job parallelization, agent distribution, and mercurial features of cruise make everyone have eight agents to work. The development process after personialbuild is roughly as follows (see figure 2): (1) the developer modifies the local code; (2) the developer puts the code in the Local pre-submission repository; (3) The personal build server detects code changes in the local pre-submitted repository and triggers the building of the personal pipeline. (4) repeated by developers (1) and (2 ), pay attention to the running results of your personal build pipeline; (5) repeated personal build servers (3); (6) developers make their last submission on their personal build servers to pass all tests; (7) Developers submit all modifications to the central code repository; (8) the team integrated the build server to discover these changed codes and trigger the team pipeline construction.

Figure 2
Its advantages are:
(1) There is no need for much preparation (originally using mecurial); (2) the distribution of cruise accelerates the feedback for personal building and testing; (3) greater flexibility (developers can selectively submit any specified local version to the central code library); (4) facilitate frequent submission and testing; (5) in the Team's continuous integration environment, the number of failures is greatly reduced; Preparations:(1) create a copy of the local code library
Hg clone cruise-personal
CD cruise-personal
Hg serve
(2) Start an agent and direct it to the personalbuild server.
Mkdir cruise-personal-agent
CP cruise/target/cruise-agent-1.3/* cruise-personal-agent
CD cruise-personal-agent
Java-jar agent-bootstrapper.jar $ {your personal build IP address}

(3) create a pipeline to point its materials to a copy of the local code library created in step 1.Specific work process:
(1) frequently go to the local checkin code; (2) use the 'Hg push .. /cruise-personal' (3) building a personal server with code changes. (4) When you need to submit data to the central code library, run the 'Hg pull -- rebase' command. Note: If you want to run a personal build, run the 'Hg push .. /cruise-personal', you will get the message 'Creating multiple heiad '. If you use the command 'Hg push-f ../cruise-personal' (note that-F), it will force push and create multiple heads. It is very difficult to create multiple headers in the central code library. However, it does not matter for a local copy of an individual. In fact, cruise will find and update it to the latest head, while ignoring the old head.

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.