Recently, looking at some data related to software quality assurance, continuous integration occupies a large part of it. This article introduces the origin, development and practice of continuous integration.
The main content is to summarize the knowledge related to continuous integration, as well as some personal reflections on continuous integration.
Reference: Jingdong system quality assurance technology practice
Other materials: Jenkins getting started guide, continuous integration: the way to improve software quality and reduce risk, continuous delivery: a systematic approach to release reliable software, agile software testing: a practical guide for testers and agile teams
Download password: un6n
1、 Origin and development
1. Origin
As for microservice architecture, I have organized a blog before. If you are interested, please go to the portal: microservice architecture
Martin flower summarizes the following principles for continuous integration:
① Maintain a unified code base;
② , code must be submitted to the trunk every day;
③ . each submission should be built in the integrated environment immediately;
④ Automation construction;
⑤ Automation test;
⑥ . automatic deployment;
⑦ Fast and continuous construction;
⑧ . the construction environment must be consistent with the production environment;
⑨ . the access rights shall be open and transparent to team members;
2, definition
Continuous integration (CI): the continuous and automated compilation, packaging, construction and test release of software projects to check the quality of software delivery.
3, composition
Auto compile + auto code check + auto package + auto test + auto deploy
4, evolution
Mode: the window of Internet opportunities is constantly shortened, which requires rapid delivery, rapid problem discovery and solution
Role: function test → automation test, performance test, security test → test development (provide various support for software development process, including tools, framework, scheme, best practice)
Post: the post boundary of development and test is becoming more and more vague, and it is approaching to quality assurance from the original Dev and test (please refer to "Google's software testing approach", which introduces how Google does testing)
5. Tools
Anthill Pro: commercial build management server, providing C function
Bamboo: commercial CI server, free for open source projects
Build forge: a multi-functional business building management tool, features: high performance, distributed building
Cruise control: a continuous integration building tool based on Java implementation
Jenkins: open source continuous integration build tool based on Java implementation, now the most popular and well-known continuous integration tool
Lunt build: an open source automatic build tool
Para build: commercial automation software build management server
2、 Why continuous integration
1. Common problems in the project
① . during integration, it is found that the system cannot operate;
② . error often occurs in merging codes between different parts;
③ . add overtime to bug;
④ , repeated manual deployment, debugging, testing and release, high cost and high risk;
⑤ , others......
2. Team culture issues
① Lack of quality awareness of delivered software
② . fail to prioritize the construction of failure
③ Lack of engineer culture
④ , lack of team management and process
3. Benefits of continuous integration
Continuous integration improves delivery efficiency and software quality
① Timely feedback the results and find out the problems as soon as possible;
② Automation instead of manual, engineers spend more time and energy on design, demand analysis, risk prevention, etc;
③ , continuous integration → continuous delivery → Devops → container based services → improve automation to improve efficiency;
3、 Build continuous integration from scratch
CI = efficient construction + comprehensive and effective testing + reasonable process specification + engineer culture + ROI
1. Efficient construction
① Efficient construction: backbone development is a powerful foundation for rapid promotion of Ci
Core: unified management of source code, test case, configuration and data
Advantages: solve the problem of difficulty in merge back to trunk and high cost of return
Solve the problem that management becomes more and more difficult with the increase of projects and branches
Fix bug to modify the trunk and fix more
To solve the problem that QA only guarantees the quality of individual branches and ignores the quality of trunk after merge
② Efficient construction: need tool support
Version control: gitsvn
Code management: gitlab private deployment
Basic environment: virtual machine, docker, kubernetes
Auto build: Jenkins
Feedback mechanism: email, SMS, wechat pin
Concrete way: build a pipeline that meets the needs of the team
2. Comprehensive and effective testing: testing exists at all stages of the project cycle
① . requirements and Design: PM / dev / QA
Requirement Review
Demand change
Design review
② Development and test: dev / QA / PM
Code review, unit test
Test plan, test case, bug management, risk assessment
Function test: smoke, integration, system, acceptance
Performance test, safety test and disaster recovery test
Online verification, exploratory testing
③ . online and online: op / QA / dev / PM
Online verification
Business monitoring
User feedback
Product evaluation
PS: the earlier the defect is found, the lower the repair cost, and vice versa
3. Reasonable process specification
① . code submission specification
Local development
Local compilation (self test, check out)
Submit to the current trunk (change log is concise and clear)
Trunk compilation (test, check out)
② . precautions
Do a good job of local compilation and self-test before submitting to the trunk
Resolve code conflicts before committing
Timely associate and add description when submitting
Pay attention to code scanning results after submission
Focus on the results of trunk integration construction after submission
Merge in time after no problem in construction
③ . principles to be followed
Trunk build failed stop code submission until build succeeded
Prioritize failed builds, fix problems
If the build cannot be repaired quickly, perform a rollback
4. Engineer culture
① Improve the awareness of software quality assurance (testing is the core)
② Establish the awareness of giving priority to the construction of failure (the highest priority)
③ Training team engineer culture (process, quality, communication, professional quality)
④ . optimize team management and all aspects of process to simplify, avoid overemphasis on process, avoid face-to-face engineering, and do a good job in resource coordination
5. ROI (return on investment)
① , from 0 to 1, acceptable input resource cost
In the initial stage, continuous compilation and packaging can be considered to timely feed back the compilation conflicts of the code version Library (fast and positive feedback);
② From 1 to 2, select the option with the highest speed improvement for overall delivery quality
You can choose continuous deployment and code check with high cost performance and regular code review to reduce the risk caused by manual deployment and code level bug;
③ , from 2 to 3, there are more and more problems
Challenge:
With the increase of construction tasks, the decrease of execution speed and overall efficiency, the success rate is lower than expected;
The maintenance of automated test scripts is large, which depends on the stability of basic test environment and test data;
Solution:
Increase task construction executor and reduce queuing (multi task distributed construction);
Split the tasks that take a long time, reduce the execution time of a single task, and decouple them;
The implementation of automated testing in later stage, layered design, lightweight UI and key API layer automation are the better results of automation testing practice in the industry;
④ , from 3 to N, challenges and expected revenue increase brought by continuous expansion
Ci is required to be highly flexible and customized due to different team project types, technology stack composition, concerns and work habits;
Need continuous resources investment;
The team spontaneously adapts, continuously adjusts and optimizes the plan and process;
The above content is my summary of my thoughts on the continuous integration of relevant materials. There are still many imperfections or mistakes. If there are better suggestions, I hope you can give me some advice...