当前位置:网站首页>[beauty of software engineering - column notes] 26 | continuous delivery: how to release new versions to the production environment at any time?
[beauty of software engineering - column notes] 26 | continuous delivery: how to release new versions to the production environment at any time?
2022-07-29 08:01:00 【if...else...】
List of articles
Column information
Columnist : The treasure jade
Column publishing platform : Geek time
primary coverage
As of today , Continuous delivery has become a recognized good development practice , More and more development teams have applied continuous delivery , It is automated , Let your code after each submission , Can automatically complete the compilation 、 Testing process , After completion, you can be ready to deploy and release .
Continuous delivery if subdivided , In fact, it can be divided into Continuous integration 、 Continuous delivery and continuous deployment Three concepts .
One 、 Integrate 、 History of deployment and delivery
The evolution of integration
When developing multi person software projects , Everyone will be responsible for the development of some functional modules , Integration refers to the branch code developed by everyone , Merge into the trunk , In order to test packaging .
The original stage of integration
Back in the age of waterfall development , In the development stage , Generally, it is not integrated . Everyone develops independently , Wait until the development phase is almost over , Then submit the code to the source code management tool , Let the code integrate , To compile 、 Deploy and publish to the test environment .

《 restructure 》 The author of Martin Fowler Said :“ If one thing is painful , Then do it more often (if it hurts, do it more often. )”, Continuous integration is also a painful thing to integrate , Do it more often .
The benefits of continuous integration are obvious :
- Cooperate with automated testing , This ensures that the trunk code is stable .
- Frequent integration allows developers to always get the latest code from the trunk in time , Not like a class library 、API Inconsistency and other problems were not exposed until the final test stage .
History of deployment and delivery
Deployment refers to publishing code to various environments , For example, deploy the test environment for testing . Delivery refers to the software product after passing the test and acceptance , Have the conditions for release to the production environment and delivery to customers .
The initial phase of deployment and delivery
In the early years , Deployment is a troublesome thing . You need to get the latest source code manually 、 compile 、 Many configurations need to be modified for the environment .
From manual deployment to script automated deployment
For programmers , If one thing can be solved automatically , Sooner or later someone will find an automated solution , Deployment has also evolved from manual deployment to Automated Deployment .
Early Automated Deployment solutions were Daily construction (Daily Build), Simply speaking , That is, after work every night , The daily builder automatically downloads the latest code from the source code manager , compile 、 Deploy the program to the test environment .
From script deployment to continuous delivery
In fact, after understanding continuous integration , It's much easier to understand continuous delivery . Continuous delivery , On the basis of continuous integration , Further , After the functions are merged into the trunk , Not only automated testing , Also packed , And deploy to the test environment .
Theoretically, it can also be deployed directly to the production environment , But this link needs to be confirmed manually .

From continuous delivery to continuous deployment
Continuous delivery , For the deployment of production environment , Manual confirmation is still needed . And continue to deploy , The only difference from continuous delivery , There is no manual confirmation , Every time the code merges from the branch to the trunk , After the automation test passes , The production environment will be deployed directly and automatically , No manual confirmation is required .
however , Continuous deployment should be done well , It's still a challenging thing , After all, from code consolidation to production environment deployment , If there is no human intervention, only rely on automated testing , This requires high coverage and stability of automated testing .
Two 、 Should the application be delivered continuously ?
We are waterfall model development , Should the application be delivered continuously ?
The answer is : Continuous delivery doesn't matter what development model you use , Waterfall model can also be applied to continuous integration , The continuous integration environment and corresponding development process should be set up as soon as possible , You can see the benefits immediately .
- Expose problems as soon as possible :Martin Fowler Said ,“ Continuous delivery cannot eliminate Bug, It's about making them easy to find and correct .”
- Greatly improve efficiency : Continuous delivery allows the development process to merge from code , Until the final deployment , Have achieved Automation , Can greatly improve efficiency .
- Improve quality : You need to pass automated tests before each merge , So there will be fewer mistakes .
- Reduce project costs : When we first set up a continuous delivery environment , It is necessary to invest a certain cost , But in the long run , Development efficiency has been improved , Code quality has improved , Instead, it is helpful to reduce the overall cost of the project .
3、 ... and 、 How to build a continuous delivery environment ?
preparation
To build your own continuous delivery environment , It's not easy to find a continuous integration tool to work , But we still need to do some preparatory work .
Let's first look at the continuous integration part , Continuous integration is relatively simple :
- Need source code management tools , for instance git、svn, Because continuous integration tools need to get code from a unified source code warehouse ;
- Need to write automated test code , Because there is a very important condition for continuous integration , The automatic test must pass ;
Continuous delivery is relatively more demanding than continuous integration , Your project needs to meet the following conditions :
- The process of building code can be repeated , And the results of each build are consistent 、 The stability of the ;
- The configuration of all environments exists in the source code management tool , It's not just code ;
- You need to automatically create distribution packages for different environments ;
- The deployment and release steps of all environments must be automated ;
Choose the right continuous integration tool
There are already many options for continuous integration tools , There are open source 、 commercial , Hosted on cable , And I built it myself .
The main continuous integration tools are these :
- Jenkins
- Go CD
- Travis CI
- GitLab CI
- Azure Pipelines
Implement according to the selected tool
After choosing the continuous integration tool you want to use , You need to build according to the instructions of the tool . This part is relatively simple , There are also many tutorials online .
Four 、 Other excerpts
- Before the code is integrated into the trunk , Must pass automated tests , As long as one test case fails , You can't integrate .
- Although continuous delivery is not yet popular , But the future is like source code management , Become the standard configuration of the development team .
- The main problem of continuous integration is to build the whole continuous integration environment , A little more trouble , In addition, it needs to cooperate with some process specifications to assist the implementation , For example, a certain coverage of automated test code is required , Only after passing the test can it be merged into the trunk .
summary
Build a continuous delivery environment , First of all, we need to be prepared , For example, automated test code and Automated Deployment scripts ; Then choose the continuous integration tool ; Finally, implement according to the selected continuous integration tool .
边栏推荐
- An optimal buffer management scheme with dynamic thresholds paper summary
- [deep learning] data preparation -pytorch custom image segmentation data set loading
- C language interview preparation I (about understanding Department)
- C language problems
- "Swiss Army Knife" -nc in network tools
- Analyze the roadmap of 25 major DFI protocols and predict the seven major trends in the future of DFI
- QT connects two qslite databases and reports an error qsqlquery:: exec: database not open
- 你学习·我奖励,21天学习挑战赛 | 等你来战
- My entrepreneurial neighbors
- [WPF] realize language switching through dynamic / static resources
猜你喜欢

Implementation of simple matcap+fresnel shader in unity

How to draw an excellent architecture diagram

Some thoughts on growing into an architect

Convert source package to RPM package
![[密码学实验] 0x00 安装NTL库](/img/2a/03d95082a2a63238b475b3f7f3e13d.png)
[密码学实验] 0x00 安装NTL库

207. Curriculum

Day 014 2D array exercise

How to connect VMware virtual machine to external network under physical machine win10 system

JVM garbage collection mechanism (GC)
![[untitled] format save](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled] format save
随机推荐
Crawl expression bag
Sort out the two NFT pricing paradigms and four solutions on the market
After the access database introduces DataGridView data, an error is displayed
Chapter contents of the romance of the Three Kingdoms
@Use of jsonserialize annotation
在js中,0表示false,非0表示true
postman接口测试|js脚本之阻塞休眠和非阻塞休眠
技术分享| 快对讲综合调度系统
MapReduce steps of each stage
Limitations of push down analysis
Data warehouse modeling, what is wide table? How to design? Advantages and disadvantages
@JsonSerialize注解的使用
MySQL 45 | 08 is the transaction isolated or not?
(视频+图文)机器学习入门系列-第5章 机器学习实践
Operator overloading
[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M
MySQL 45 talk | 07 line lock merits and demerits: how to reduce the impact of line lock on performance?
Jiamusi Market Supervision Bureau carried out special food safety network training on epidemic and insect prevention
String class
Ue4/ue5 C disk enlargement processing