The continuous integration (continuous INTEGRATION,CI) was approached shortly before.
One, continuous integration is what
First, the concept of "integration". In the actual software development, two kinds of situations often occur:
1. Several project teams develop separate functions for the same system, ultimately requiring the integration of all software functions into a single system;
2. After the software development, due to various reasons to update the upgrade.
These two situations are actually the meaning of integration.
After understanding the concept of "integration", the concept of "continuous integration" is well understood. As the name implies, is more frequent "automatic integration" this link. (Why do I have to integrate it automatically?) Please refer to the third part of this article: what to use for continuous integration)
second, the use of continuous integration can have any advantage
From the concept of continuous integration, it is easy to see that its core idea is "step by step", this idea brings the following benefits:
- Allows the code to be rolled back in time when the test fails or an error occurs.
- Constantly test and fix integration issues to avoid cramming.
- Alert issues and conflict codes.
- All code changes can be tested in a timely manner.
- Provide developers with timely feedback on the functionality, quality, and impact of their writing code.
- Frequent code checks encourage developers to write modular and concise code.
- The project is kept in a running state at all times.
---------------------------------------
There are advantages, there will also be disadvantages, here briefly say:
- Powerful test suites and well-written test code will give you the benefit of automated testing.
- A certain amount of hardware costs (small items are negligible).
- The labor cost of the initial deployment.
third, what is the use of continuous integration
The process of integrating software is not a new problem, and software integration is not a problem if the size of the project development is small. However, if the project is large and you need to add new features constantly, you need to integrate often, which requires continuous integration.
Iv. How continuous integration is implemented
The implementation of continuous integration, there are many statements, I agree with Nanyi Teacher's statement (link: http://www.ruanyifeng.com/blog/2015/09/continuous-integration.html?utm_source=tuicool).
For the convenience of viewing, I directly quoted the contents of teacher Ruan's implementation:
--------------------------------------------------------------------------------------------------------------- -------------------------
1 Submit
The first step in the process is for developers to submit code to the code repository. All subsequent steps begin with a commit (commit) of the local code.
2 Test (first round)
The code warehouse configures a hook for the commit operation, and runs automated tests as long as the code is submitted or merged into the trunk.
There are several kinds of tests.
- Unit tests: Testing for functions or modules
- Integration testing: Testing for a function of a whole product, also known as functional testing
- End-to-end testing: Full-link testing from the user interface to the database
The first round must run at least unit tests.
3 Build
With the first round of testing, the code can be incorporated into the trunk, even if it can be delivered.
Once delivered, the build is built before the second Test. The so-called construction, refers to the conversion of the source code can be run real, such as installation dependencies, configuration of various resources (style sheets, JS scripts, pictures) and so on.
The common build tools are as follows.
- Jenkins
- Travis
- Codeship
- Strider
Jenkins and Strider are open source software, and Travis and codeship are free to use for open source projects. They will all be built and tested and executed in one run.
4 test (second round)
When the build is complete, a second round of testing is necessary. If all the test content is covered in the first round, the second round can be omitted, and of course, the build step is moved to the front of the first Test.
The second round is the full test, the unit test and the integration test will run, if conditional, also do end-to-end testing. All tests are automated, and a few test cases that cannot be automated will be run manually.
It is important to emphasize that each update point of the new version must be tested. If the test coverage is not high, serious problems are likely to occur after you enter the later deployment phase.
5 Deployment
With the second round of testing, the current code is a version that can be deployed directly (artifact). All files of this version are packaged ( tar filename.tar *
) archived and sent to the production server.
The production server will package the files, unpack them into a local directory, point the symbolic Link (symlink) of the running path to the directory, and then restart the app. The deployment tools in this area are Ansible,Chef,Puppet , etc.
6 Rolling back
Once there is a problem with the current version, roll back to the build results of the previous version. The simplest way to do this is to modify the symbolic link to point to the previous version of the directory.
--------------------------------------------------------------------------------------------------------------- -------------------------
It is important to note that the 3rd step-build, which is the core step of continuous integration implementation. The current use of the larger is Jenkins, readers can refer to the relevant Jenkins blog content.
v. Acknowledgements
Thank you very much for the perspective of Nanyi teacher, who bought Mr. Ruan's book "How To Be thought" when he was in college, and his thinking and writing style made me much more helpful.
Vi. Reference Links
What is continuous integration? -Nanyi's Blog Http://www.ruanyifeng.com/blog/2015/09/continuous-integration.html?utm_source=tuicool
Integrated open source system for automated building, code quality assessment, project information statistics-Lone Sword-Blog Park http://www.cnblogs.com/AloneSword/archive/2011/11/05/2236950.html
Welcome to Jenkins ci! | Jenkins CI http://jenkins-ci.org/
Research on continuous Integration (CI)