什么是CI/CD?

CI/CD is the combined practices of continuous integration (CI) with continuous delivery or continuous deployment (CD). The purpose of CI/CD is to allow development teams to deliver code changes more frequently 和 reliably.

What’s the Difference Between Continuous Integration, Continuous Delivery, 和 Continuous Deployment? 

CI/CD中的CI代表持续集成. Continuous integration means that developers frequently merge their code changes to a shared repository. It’s an automated process that allows multiple developers to contribute software components to the same project without integration conflicts. CI involves automated testing whenever a software change is integrated into the repository.

CD既可以表示持续交付,也可以表示持续部署. Both involve taking the code continuously integrated 和 getting it able to deploy to an environment either QA or production. Continuous deployment takes the process one step further 和 performs the actual deployment to an environment.

CI/CD为什么重要?

When large pieces of a code base change at a time it puts an application's quality at higher risk. This is because there is more likely a chance that something will break the larger the change - 和 troubleshooting is harder the larger the change. Agile organizations frequently integrate their code 和 perform automated tests to reduce the cost of introduction, 识别根本原因, 修复bug.

自动化是持续集成的关键. There is no way someone could keep up manually at the speed needed for continuous integration to be successful. Developers need to integrate frequently 和 need feedback as soon 尽可能.

持续交付和持续部署具有相似的目标, 因为他们使用自动化来减少时间, 努力, 以及发布版本所涉及的风险. 持续交付快速高效. 每个构建都会在每个环境中自动进行测试, 如果它通过了, 只需单击一下即可手动部署代码. The preparation is automated, but the push to production is often initiated by the operations team. 

通过持续部署, 其中,到生产的发布是完全自动化的, 你放弃了一些控制权. 与此同时,您还获得了额外的优势. You can develop at an even higher velocity than the already-fast continuous delivery, 因为您不需要为发布而暂停开发, 和 your customers will appreciate the steady stream of improvements.

CI/CD的主要挑战是什么?

The benefits of CI/CD are numerous, but implementing the process can present challenges. 第一个, while continuous integration 和 continuous delivery/deployment are related, 它们是CI/CD管道的不同部分. 当组织不理解其中的区别时, 他们最终可能会单独实现CI,并称之为CI/CD. 为适当的CI/CD, your continuous code integration—likely done with a CI-specific tool—needs to feed into automated processes for testing 和 deployment. 

CI/CD涉及许多参与者. 和所有DevOps方法一样, 它需要发展之间强有力的合作, QA, 以及运营团队(许多组织中的另一个挑战). Teams often struggle with the fact that dev, QA, 和 ops are pursuing seemingly contradictory goals. Developers want to put out new code quickly 和 have creative freedom. QA希望测试代码以最小化带有任何bug的版本. Operations wants the code to be released 和 run in a way that is safe, accurate, 和 controlled.

幸运的是,良好的CI/CD设置有助于这种类型的合作. Developers stay productive 和 efficient because they don’t have to spend too much time debugging, 和 operations can rest assured that code is well prepared for release. 从一个团队到另一个团队的交接是自动化的,而且不那么痛苦. 为了达到最佳效果, it’s important to make sure everyone is clear on who owns which part of the pipeline as well as the overall process. 

An additional challenge is knowing how to implement a new CI/CD process. 自动化是必不可少的, 是频繁的, repetitive processes can delay the CI/CD pipeline 和 can be highly prone to errors if completed manually. It’s recommended to start with automation within a small team to demonstrate success to the leadership team for a broader automation 努力. 

如今,安全性对每个组织来说都是一个挑战, 和 security measures are too often an afterthought in the DevOps process when they should be integrated as early in the 软件开发生命周期 尽可能. That way security risks are detected early, when they are less costly to fix.

为什么要采用CI/CD模型?

CI/CD促进了更快的上市时间. 自动化简化了流程的某些部分, 而更快的错误检测可以减少灭火时间. Customer satisfaction can increase as well when you’re providing more regular updates 和 a positive user experience. 

The incremental changes 和 automated integration of CI can improve the quality of code in each update. Reducing the instances of faulty code getting pushed to production has countless positive business impacts.    

当速度和精度提高时,成本就会下降. Your CI server can run hundreds of tests within seconds, drastically cutting down on testing costs. 毫无疑问,您有使用CI/CD的竞争对手, 如果你坚持传统的模式, 你会被抛在后面.

如何在您的组织中开始CI/CD

向CI/CD的转换最好分阶段完成. This allows developers to learn 和 adapt to process changes 和 ensures that the new process will be fully tested before its introduction to production systems.

要为CI/CD的成功做好准备,请从以下步骤开始:

  1. Move software from your developers’ machines—resolving any disparities—into a version control (VC) process, 例如Git或SVN.
  2. Build local developer instances with Vagrant or a similar tool to allow for some local testing.
  3. Document your procedures for pushing code into VC 和 dealing with merge conflicts. 确保你的员工得到适当的培训.
  4. 根据需要将代码从VC进程迁移到您的生产环境中.

Now that you’ve built a solid foundation on which to start your full CI/CD migration, 你可以进入下一个阶段:

  1. 添加一个供开发人员推送的登台服务器. 这允许在生产之前进行未来的QA测试.
  2. Choose a CI/CD tool, such as Jenkins, to automate the pushes from staging to production. 你可以选择在这个时候介绍基本的绒毛.
  3. 从建立安全感开始 动态应用安全测试(DAST) 解决方案, 自动化QA测试, 以及任何额外的编译步骤(例如最小化JavaScript), CSS, 连接文件, 检查软件来源 cf等.)

现在您拥有了一个功能性的CI/CD进程. 大部分的 安全自动化 会被软件执行吗, but it’s essential that your developers have proper training on both software 和 processes.

阅读更多关于Web应用程序安全的信息

了解Rapid7的Web应用程序安全产品

DevOps安全:博客的最新消息

" class="hidden">畅游论坛