Continuous integration: Practice Guide

Source: Internet
Author: User
Tags version control system continuous integration tools

 

Part 1. Implementation 0. Functions of continuous integration tools

Reduce Risks? No

Improve quality? No

Quick feedback? Yes!

The tool itself cannot reduce project risks and improve code quality. the only thing the tool can do is to give you quick feedback. the behavior after you receive feedback is the key to reducing risks and improving the quality (not checking for several days)
In, the tool is useless. The failed build is not repaired, and the tool is powerless)

Therefore, continuous integration is a human-centeredProcessThe tool is only a product we use in this process, and it is definitely not the only one.

 

Fast feedback: fast feedback is actually two words, fast and feedback. Continuous integration involves two aspects: People and tools. Therefore, a good continuous integration process, it must be implemented and improved in at least four aspects:

  1. How to implement quick tools

  2. Effective feedback on tools

  3. How do people make feedback faster?

  4. How can people make feedback more effective?

 

1. How to quickly monitor changes by 1.1 (Embracing Change is one of agile attitudes, and continuous integration tools are the product that demonstrates this attitude)
  • Source code-based changes: check in, the tool must support multiple Version Control Systems

  • Dependency-based changes: Project A changes will trigger Project B's construction, and tools must be able to manage dependencies between projects.

  • Changes based on other resources: file systems, HTTP resources (server startup)... this is not just the focus of continuous integration. Most EAI systems are integrated based on changes in external resources.

  • Time-based changes: Build (it gives you feedback when you first enter the office at work in the morning, so it does not take up any work time. It is fast enough)

  • Mood-based changes: You are in a hurry and want to immediately check your check in results, instead of waiting a few minutes for the tool to schedule, the tool must support "Force build"

 

1.2 do your best to accelerate building
  • Multithreading: multi-thread on a powerful server to build multiple projects concurrently

  • Distributed: use resources of other machines in the network to build multiple projects concurrently, or different parts of a project.

  • Virtual machines: In addition to concurrent building, they can implement Environment isolation.

  • Phased building: it can be seen as a variant of dependencies between projects. Users can divide a project into multiple stages. After phase A is built, phase B's construction can be triggered,
    However, even if phase B is not over and a new check in is available, Phase A is triggered again without waiting for Phase B to end. typical application scenarios include unit test and function test in different stages.

 

1.3 dynamically update configurations or automatically load user-modified configurations
  • Allows you to modify configurations online.

  • The user modified the configuration of the project and should take effect immediately without restarting the CI server.

  • Saves the historical version of your configuration to help you fix errors that you accidentally introduced during the configuration process.

 

2. How do people make feedback faster 2.1 frequent check in

However, there is a balance or compromise. Each check in should ensure that a relatively independent task is completed. Try not to put one task in multiple check in; otherwise, once a revert is required,
More steps are required.

2.2 check in token

This can be seen as one of the problems caused by frequent check in. This has nothing to do with CI tools. This is helpful to the efficiency of the entire team.

2.3 optimize build scripts or code

Avoid unnecessary # include

Incremental build (there is a trade-off here. Generally, two builds in the CI environment should not affect each other; developers can perform incremental build on their own machines)

 

3. How to effectively provide feedback using tools 3.0 do not recommend emails and do not use them unless necessary
  • Emails are asynchronous and not timely

  • It is unstable due to the influence of SMTP server and Mail Client

  • It is often drowned in other emails and is not noticed.

  • It is too dependent on the user sitting in front of the computer, not flexible

3.1 sound and color, light (speed: 340 Mb/s and 0.3 million km per second)
  • Play unwanted music for failed builds

  • Use the text reading engine to read the name of the person who destroys the building.

  • Lava Lamp

  • Large display screen, Web Interface

3.2 desktop notification program
  • Cctray

  • Yahoo widget

  • Firefox Plugin

  • IDE plugin

  • RSS reader

3.3 The feedback includes not only the build results, but also the events that occur during the build process.
  • Provides build output or log

  • Provides source code changes that trigger the build, such as version number, author, comments, and even built-in diff functions.

  • Provides building statistics, such as build duration and remaining time.

 

4. How do people make feedback more effective 4.1 Workspace

All team members should be in the same room to better utilize the benefits of sound/light feedback.

Even if there is no CI, the team should stay in the same room and quickly solve any problems encountered by anyone without CI.

4.2 Automated Testing

What feedback does CI tools give us? It is not determined by CI tools, but by ourselves. The fewer tests you write, the less feedback CI tools give you.

4.3 automation everything that can be automated

In the same way, the more CI tools you use, the more feedback it gives you. the advantage of Ci tool is that it can execute scripts, applications, and other things supported by any operating system.

4.4 claim responsibility

When the build fails, someone should respond quickly and tell everyone that I will fix it. This will avoid either waiting for someone to fix it, or multiple people are repairing it independently, wasting time.

 

Part 2: Use

 

From the perspective of continuous integration implementers, what should we do with continuous integration from the perspective of users? What requirements do we need continuous integration to meet?

 

If I am a project manager

  • Current Project Status, successful or failed

  • Code test coverage and other quality indicators

  • Build frequency, reflecting development efficiency

  • Build on all target platforms supported by my products

  • The latest product demo requires you to write a deployment script so that the CI tool can deploy the product to the product or demo environment.

 

If I am a developer

  • Build result, test run result, cause of failure

  • Build information in the relevant version control system to quickly find out who checked in caused the build failure

  • Labels can be added to the version control system according to pre-defined rules

  • Personal build, it is best to help me run the build before check in, and automatically help me check in after success

  • Support as many version control systems and build tools as possible

 

If I am a tester

  • Download any version of the product for installation and testing

 

If I am a CI environment maintainer

  • Provides the UI, command line, configuration file, database, and other methods for Environment configuration.

  • Detailed and accurate debugging information for quick CI environment repair

  • Fault Tolerance of Ci server and intelligent management of historical data

  • Easy to expand

  • Permission management. You do not want to modify or destroy key configuration information, and do not want to forcibly build without restrictions.

 

Part 3: goals

 

Therefore, continuous integration is a specialized field, but for users, it is only a means, not a target

What is the goal? Therefore, we will implement the CI environment that meets our needs at minimum cost based on the actual needs in the development process.

Continuous integration itself has no technical content, but there are too many details. We do not recommend that everyone in the project implement continuous integration, which involves too much effort. This is almost different from software development,
There is a specialization in the industry, and implementing continuous integration is not a big deal. The threshold is very low.

However, it can also be said that we suggest establishing a continuous integration team within the company, or a CI team within the Department if the company is large, build a unified continuous integration platform for all projects within the scope,
Just like the company's IT department, test department, and Quality Management Department, this allows the project team to focus on our core business, our strengths, that is, product development.

 

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.