当前位置:网站首页>[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 .
边栏推荐
- Do you want to meet all the needs of customers
- [paper reading] tomoalign: a novel approach to correcting sample motion and 3D CTF in cryoet
- 佳木斯市场监管局开展防疫防虫害专题食品安全网络培训
- (视频+图文)机器学习入门系列-第5章 机器学习实践
- String class
- 你学习·我奖励,21天学习挑战赛 | 等你来战
- Taiyuan bus route crawling
- Excellent urban design ~ good! Design # visualization radio station will be broadcast soon
- How to connect VMware virtual machine to external network under physical machine win10 system
- CentOS deploy PostgreSQL 13
猜你喜欢

Ansible (automation software)

QT connects two qslite databases and reports an error qsqlquery:: exec: database not open

Unity - default rendering pipeline - sculpt shader

Amaze UI icon query

Unicode私人使用区域(Private Use Areas)

UE4 principle and difference between skylight and reflecting sphere

Solve the problem that CSDN cannot publish blog due to unknown copyright

NLP introduction + practice: Chapter 5: using the API in pytorch to realize linear regression
![[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M](/img/5e/69987afcd1e50ba37bc49441dd3a50.png)
[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M

Detailed explanation of two modes of FTP
随机推荐
String class
[cryptography experiment] 0x00 install NTL Library
[dry goods memo] 50 kinds of Matplotlib scientific research paper drawing collection, including code implementation
Autojs微信研究:微信自动发送信息机器人最终成品(有效果演示)
Processes and threads
Detailed explanation of the find command (the most common operation of operation and maintenance at the end of the article)
Some simple uses of crawler requests Library
Solve the problem that CSDN cannot publish blog due to unknown copyright
Dynamically load data
Output 1234 three digits without repetition
In an SQL file, a test table and data are defined above, and you can select* from the test table below
Amaze UI icon query
Qt/PyQt 窗口类型与窗口标志
How to draw an excellent architecture diagram
The smallest positive number that a subset of an array cannot accumulate
Go 事,如何成为一个Gopher ,并在7天找到 Go 语言相关工作,第1篇
CDM - code division multiplexing (easy to understand)
Internet worm
在一个sql文件中,上面定义一个测试表及数据,下面可以select* from 测试表
[note] the art of research - (tell a good story and argument)