什么是 CI/CD?

CI/CD,或持续集成/持续交付或部署,是一种采用自动化技术的软件开发实践。通过持续的代码交付,频繁可靠的更新加快了发布周期。

CI/CD 详解

CI/CD 是一个涵盖多个 DevOps 阶段的总称。CI(持续集成)是每天多次将代码更改集成到代码仓库中的做法。CD 有两个含义:Continuous Delivery(持续交付)自动化代码集成,而 Continuous Deployment(持续部署)自动向终端用户发布最终构建。 CI/CD 的频繁测试减少了代码错误和缺陷,使其对每个 DevOps 工作流程都至关重要。

 

源代码管理

持续集成 (CI)

CI 是一种 DevOps 最佳实践,也是 DevOps 生命周期的一个阶段,期间,开发人员将代码签入其共享代码的代码仓库,通常每天数次。理想情况下,自动构建工具每次都会验证签入或分支,以确保没有错误并且已准备好投入生产。主要优势是通常会早期发现问题,避免累积成更大的问题。

采用 CI 意味着频繁集成较小的更改,而不是低频次地一次集成大量更新。将测试、合并和签入共享代码仓库更改的工作流程自动化,意味着团队能够以更快的速度交付更简洁的代码。更简洁的代码意味着更快的验证、更简洁的发布,以及更容易扩展的更高效的开发流程。

 

持续集成 (CI)

CI 是一种 DevOps 最佳实践,也是 DevOps 生命周期的一个阶段,期间,开发人员将代码签入其共享代码的代码仓库,通常每天数次。理想情况下,自动构建工具每次都会验证签入或分支,以确保没有错误并且已准备好投入生产。主要优势是通常会早期发现问题,避免累积成更大的问题。

采用 CI 意味着频繁集成较小的更改,而不是低频次地一次集成大量更新。将测试、合并和签入共享代码仓库更改的工作流程自动化,意味着团队能够以更快的速度交付更简洁的代码。更简洁的代码意味着更快的验证、更简洁的发布,以及更容易扩展的更高效的开发流程。

 

持续集成 (CI)

CI 是一种 DevOps 最佳实践,也是 DevOps 生命周期的一个阶段,期间,开发人员将代码签入其共享代码的代码仓库,通常每天数次。理想情况下,自动构建工具每次都会验证签入或分支,以确保没有错误并且已准备好投入生产。主要优势是通常会早期发现问题,避免累积成更大的问题。

采用 CI 意味着频繁集成较小的更改,而不是低频次地一次集成大量更新。将测试、合并和签入共享代码仓库更改的工作流程自动化,意味着团队能够以更快的速度交付更简洁的代码。更简洁的代码意味着更快的验证、更简洁的发布,以及更容易扩展的更高效的开发流程。

 

持续集成与持续交付

持续交付

持续交付紧随 CI,您可以将其视为开发流程中的一个检查点阶段,位于在最终产品发布或部署给客户之前。验证代码更改后,它们会自动交付到代码仓库。 

持续交付的目标是保持变更集足够小,使得主构建的任何更新都不会影响最终产品的”生产就绪”状态,如果它没有发布就绪。最终产品可能包含次要错误,但不会影响用户体验。

采用持续交付意味着开发人员可以花费更少的时间进行内部测试,因为这会确保只有稳定的代码才能进入交付阶段。它使错误检测成为一个更简单的过程,加快解决进度。

CI/CD 的优势

快速迭代

作为 DevOps 生命周期的一部分,CI/CD 将验证和部署代码库更改的手动工作自动化完成,从而加速了开发。

更清洁的代码

通过日常检查大量的小规模更改,可大幅降低将构建破坏错误引入源代码的风险。

更快的错误修复

CI/CD 流程可更频繁地将较小的变更集合并,从而更轻松地识别代码错误,并及时修复,避免其累积成为更严重的问题。

更短的反馈循环

CI/CD 有助于缩短反馈循环,这是 DevOps 的核心原则, 因为较小的迭代更改更容易集成、测试和部署。

改善协作

通过定义代码提交和构建启动的流程和时间表,CI/CD 使工作更加清晰。有了更明确的目标,团队可以更敏捷地行动。

更快乐的客户

因为构建始终可以通过 CI/CD 随时发布,减少了客户经历的服务中断,并且可以更快地集成他们的反馈。

类似读物

探索更多资源,了解 CI/CD 和其他 DevOps 解决方案和流程。

敏捷与 DevOps

敏捷和 DevOps 具有相同的目标 – 通过定期发布时间表来交付客户价值 –  但它们采用的方法略有不同。了解它们如何一起发挥作用。

DevOps 的优势

实施 DevOps 实践可以简化您的开发流程,让您的团队和用户更快乐。详细了解 DevOps 如何为您提供帮助。

了解源代码管理

源代码管理 (SCM) 帮助团队快速工作和高效协作。了解关于版本控制工具、使用时间及工作原理的所有信息。

Unity 的 CI/CD 解决方案

通过 Unity 的 CI/CD 解决方案,使您的项目快速迭代,并利用强大的源代码管理和自动化。选择 Unity Cloud Build 进行分布式工作,或使用 Unity Build Server 扩展您的本地构建容量。

CI/CD Frequently asked questions

Is agile the same as CI/CD?

An agile workflow and CI/CD are related, however, they are not the same! They describe completely different aspects of the software development pipeline. Agile development, refers to the process or methodologies for managing workflows, meeting cadences, and team organization in software development. An agile methodology embraces change while accelerating delivery by listening and responding to customer needs and involving them in each stage of the development process.

CI/CD relies on automation to remove the human elements that create bottlenecks in releasing and improving the software. In both CI and CD testing is automated throughout the pipeline and is done frequently to minimize the costs and time it takes to remediate defects.

 

How often should you be deploying to production with continuous deployment?

With CI/CD, releases should always be frequent to avoid future problems and assure your software is always in a releasable state - typically deploying multiple times a day. A common assumption with CI/CD teams should be implementing "constant" releases, however, this is not always the case. Your release cycle can vary widely depending on your product, your builds, and other factors you might want to take into consideration such as:

Is it a critical or minor fix?

Are you tracking regression counts from build to build?

Is there a QA team put in place?

Does the code base have unit tests?

Are there any code duplications?

These are just a few examples of aspects to consider when thinking about a release strategy and pipeline, but it differs drastically from team to team. Different products require different approaches.

Is continuous deployment worth it?

There is no one size fits all answer to this question. Before investing in continuous deployment a business must first assess what the biggest risks are of their product and then determine the tradeoffs in how you want to deploy software. The success of your product is dependent on being able to quickly iterate, get feedback from your customers, and continue to make changes. Continuous deployment will be highly impactful and profitable if you are prioritizing shortening feedback loops and building a highly responsive business. However, if your business does not have many customers then the benefits of implementing increments of deployment will add less value and more costs. The staging environment you choose to deploy ultimately depends on your business needs, workflow, and budget.

Does continuous delivery encourage configuration as code?

Continuous delivery does encourage configuration because it continuously makes changes to the original code in the configuration. This ensures that the configuration stays up with code errors that may occur over time.

我们使用 Cookie 来确保为您提供网站的最佳体验。有关更多信息,请访问我们的 Cookie 政策页面

明白了