您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Release 工程:应用程序开发Release Engineering: Application Development

采用新式版本管理策略的主要目标之一就是构建系统,使你的团队能够将创意转变为生产交付的软件,使其尽可能少。One of the primary goals of adopting modern release management strategies is to build systems that allow your teams to turn ideas into production delivered software with as little friction as possible. 在此部分的 Well-Architected 框架中,将检查用于快速可靠地交付软件的方法和工具。Throughout this section of the Well-Architected Framework, methods and tools for quickly and reliably delivering software are examined. 你将了解持续部署软件、集成策略和部署环境等方面的信息。You will learn about things like continuous deployment software, integration strategies, and deployment environments. 提供的示例可帮助你快速了解这项技术。Samples are provided to help you quickly get hands-on with this technology.

不过,版本工程不会从别致的部署软件、多个部署环境或 Kubernetes 群集开始。However, release engineering does not start with fancy deployment software, multiple deployment environments, or Kubernetes clusters. 在检查如何快速可靠地发布软件之前,需要先了解如何开发软件。Before examining how we can quickly and reliably release software, we need to first look at how software is developed. 云计算的引入不仅对软件的交付和运行方式有重大影响,而且还对软件的开发方式产生了重大影响。Not only has the introduction of cloud computing had a significant impact on how software is delivered and run, but it's also had a huge downstream impact on how software is developed. 例如,引入容器技术已改变了如何托管、缩放和弃用软件。For example, the introduction of container technology has changed how we can host, scale, and deprecate software. 也就是说,当我们开发软件时,容器也会受到影响,如依赖关系管理、主机环境和工具。That said, containers have also impacted things like dependency management, host environment, and tooling as we develop software.

本文详细介绍了构建云开发策略时可能需要考虑的许多做法。This article details many practices that you may want to consider when building strategies for developing for the cloud. 主题包括:Topics include:

  • 开发环境,或编写代码的位置。Development environments, or where you write your code.
  • 源控制和分支策略、管理、协作和最终部署代码。Source control and branching strategies, how you manage, collaborate on, and eventually deploy your code.

开发环境Development environments

为云或任何环境开发软件时,需要注意确保开发环境已成功设置。When developing software for the cloud, or any environment, care needs to be taken to ensure that the development environment is set up for success. 设置开发环境时,可以考虑以下问题:When setting up a development environment, you may consider questions like the following:

  • 如何实现确保所有依赖项都已就绪?How do I ensure that all dependencies are in place?
  • 如何最好地将我的开发环境配置为模拟生产环境?How can I best configure my development environment to emulate a production environment?
  • 如何实现开发代码,其中可能存在包含在生产中的代码的服务依赖项吗?How do I develop code where service dependencies may exist with code already in production?

以下部分简要介绍了在本地或通常称为 "内部循环" 开发过程的辅助技术。The following sections briefly detail technology that aids during the local or what is often referred to as "inner-loop" development process.

Docker DesktopDocker Desktop

Docker Desktop 是一个在开发系统上提供 Docker 环境的应用程序。Docker Desktop is an application that provides a Docker environment on your development system. Docker Desktop 不仅包括 Docker 运行时,还包括应用程序开发工具和本地 Kubernetes 环境。Docker Desktop includes not only the Docker runtime but application development tools and local Kubernetes environment. 使用 Docker Desktop,你可以使用任何语言进行开发、创建和测试容器映像,并在准备就绪时,将应用程序就绪容器映像推送到容器注册表以供生产使用。Using Docker Desktop, you can develop in any language, create and test container images, and when ready, push application ready container images to a container registry for production use.

了解详细信息Learn more

Docker DesktopDocker Desktop

适用于 Linux 的 Windows 子系统Windows Subsystem for Linux

许多应用程序和解决方案都是在 Linux 上构建的。Many applications and solutions are built on Linux. 适用于 Linux 的 windows 子系统在 Windows 计算机上提供了一个 Linux 环境,其中包括许多命令行工具、实用工具和 Linux 应用程序。Windows Subsystem for Linux provides a Linux environment on your Windows machines, including many command-line tools, utilities, and Linux applications. 提供多个 GNU/Linux 分发版,可在 Microsoft Store 中找到。Multiple GNU/Linux distributions are available and can be found in the Microsoft Store.

了解详细信息Learn more

文档:适用于 Linux 的 Windows 子系统文档Documentation: Windows Subsystem for Linux Documentation

Bridge to KubernetesBridge to Kubernetes

桥接 Kubernetes 使你可以在连接到 Kubernetes 群集时运行和调试开发系统上的代码。Bridge to Kubernetes allows you to run and debug code on your development system while connected to a Kubernetes cluster. 此配置在处理微服务类型体系结构时非常有用。This configuration can be helpful when working on microservice type architectures. 使用 Bridge,你可以在一个服务上本地运行,该服务依赖于其他服务。Using Bridge, you can work locally on one service, which has a dependency on other services. 桥管理开发系统与在 Kubernetes 群集中运行服务之间的通信,而不需要在开发系统上运行所有依赖服务或将开发代码部署到群集。Rather than needing to run all dependant services on your development system or deploy your in-development code to the cluster, Bridge manages the communication between your development system and running services in your Kubernetes cluster. 实质上,开发系统上运行的代码的行为就像它在 Kubernetes 群集中运行一样。Essentially, the code running on your development system behaves as if it's running in the Kubernetes cluster.

桥的某些功能:Some features of Bridge:

  • 适用于 Azure Kubernetes Service (AKS) 和非 AKS 群集 (预览) 。Works with Azure Kubernetes Service (AKS) and non-AKS clusters (in preview).
  • 重定向 Kubernetes 群集与开发系统上运行的代码之间的流量。Redirects traffic between your Kubernetes cluster and code running on your development system.
  • 支持隔离的流量路由,这在共享群集中非常重要。Support for isolated traffic routing, which is important in shared clusters.
  • 将环境变量和已装入的卷从群集复制到开发系统。Replicates environment variables and mounted volumes from your cluster to your development system.
  • 群集诊断日志可用于开发系统。Cluster diagnostic logs are made available on your development system.

了解详细信息Learn more

其他工具Other tools

容器管理的工具生态系统有丰富的选项。The tooling ecosystem for container management is rich with options. 下面是开发基于容器的应用程序时要考虑的几个附加工具。Here are a few additional tools to consider while developing container-based applications.

Podman -用于使用容器的开源工具。Podman - an open-source tool for working with containers.

源代码管理Source control

源代码管理管理 (SCM) 系统提供一种方式来控制、协作和查看软件更改。Source control management (SCM) systems provide a way to control, collaborate, and peer review software changes. 当软件合并到源代码管理中时,系统会帮助管理代码冲突。As software is merged into source control, the system helps manage code conflicts. 最终,源代码管理提供软件、修改和参与者的运行历史记录。Ultimately, source control provides a running history of the software, modification, and contributors. 无论软件是开源的还是专用的,使用源代码管理软件都是管理软件开发的标准化方法。Whether a piece of software is open-sourced or private, using source control software has become a standardized method of managing software development. 如 Well-Architected 框架的后续部分中所述,源代码管理系统也可以通过集成测试、安全和发布实践来启用。As detailed in later sections of the Well-Architected Framework, source control systems can also be enlightened with integrated testing, security, and release practices. 由于采用了云做法,并且通过代码管理了很多云基础结构,因此版本控制系统也成为基础结构管理的有机组成部分。As cloud practices are adopted and because so much of the cloud infrastructure is managed through code, version control systems are also becoming an integral part of infrastructure management.

许多源代码管理系统由 Git 提供支持。Many source control systems are powered by Git. Git 是一个分布式版本控制系统,其中包含相关的工具,使你和你的团队可以在软件开发生命周期中跟踪源代码更改。Git is a distributed version control system with related tools that allow you and your team to track source code changes during the software development lifecycle. 使用 Git,你可以创建该软件的副本、进行更改、提出更改,并对你的建议进行同行评审。Using Git, you can create a copy of the software, make changes, propose the changes, and receive peer review on your proposal. 在对等检查期间,Git 使你可以轻松准确地查看所建议的更改。During peer review, Git makes it easy to see precisely the changes being proposed. 建议的更改获得批准后,Git 可帮助将更改合并到源,包括冲突解决。Once the proposed changes have been approved, Git helps merge the changes into the source, including conflict resolution. 如果在任何时候需要还原更改,则 Git 还可以管理回滚。If, at any point, the changes need to be reverted, Git can also manage rollback.

让我们看一下控制软件和基础结构配置的几个方面。Let's examine a few aspects of version controlling software and infrastructure configurations.

版本控制和代码更改Version Control and code changes

除了向我们提供存储代码的位置外,源代码管理系统使我们可以了解当前的软件版本,并识别当前版本和过去版本之间的更改。Beyond providing us with a place to store code, source control systems allow us to understand what version of the software is current and identify changes between the present and past versions. 版本控制解决方案还应提供一个方法,用于在需要时恢复到以前的版本。Version control solutions should also provide a method for reverting to the previous version when needed.

下图演示了如何使用 Git 和 GitHub 来查看建议的代码更改。The following image demonstrates how Git and GitHub are used to see the proposed code changes.


分叉和拉取请求Forking and Pull Requests

使用源代码管理系统,您可以创建自己的名为分叉的软件源副本。Using source control systems, you can create your own copies of the software source called forks. 在实施分支后,就可以对软件进行更改,而不会造成更改影响软件当前版本的风险。With your fork in place, changes can be made to the software without the risk that the changes will impact the software's current version. 对在分叉中所做的更改满意后,可以通过所谓的 "拉取请求" 将更改合并到主源代码控件中。Once you are happy with the changes made in your fork, you can suggest that your changes be merged into the main source control through what is known as a pull request.

同行评审Peer Review

随着软件和基础结构配置的更新,版本控制软件允许我们在将这些更改合并到源之前对其进行建议。As updates are made to software and infrastructure configurations, version control software allows us to propose these changes before merging them into the source. 在此方案中,对等方可以查看更改、建议更新并批准更改。During the proposal, peers can review the changes, recommend updates, and approve the changes. 源代码管理解决方案提供了一个很好的平台,可用于对软件的更改进行协作。Source control solutions provide an excellent platform for collaboration on changes to the software.

若要了解有关使用 Git 的详细信息,请访问 DevOps 资源中心To learn more about using Git, visit the DevOps Resource Center.


GitHub 是使用 Git 的常用源代码管理系统。GitHub is a popular source control system that uses Git. 除了核心 Git 功能,GitHub 还包括一些其他功能,如访问控制、诸如代码问题的协作功能、项目板、wiki 和称为 GitHub 操作的自动化平台。In addition to core Git functionality, GitHub includes several other features such as access control, collaboration features such as code issues, project boards, wikis, and an automation platform called GitHub actions.

了解详细信息Learn more


Azure ReposAzure Repos

Azure DevOps 是用于在任何环境中构建、协作、测试和交付软件的服务的集合。Azure DevOps is a collection of services for building, collaborating on, testing, and delivering software to any environment. Azure DevOps Services 包括 Azure Repos,这是一个源代码管理系统。Azure DevOps Services include Azure Repos, which is a source control system. 使用 Azure Repos 包括无限制的免费专用 Git 存储库。Using Azure Repos includes unlimited free private Git repositories. 标准 Git Azure Repos,你可以使用所选的客户端和工具来处理它们。Standard Git powers Azure Repos, and you can use clients and tools of your choice for working with them.

了解详细信息Learn more

文档: Azure ReposDocumentation: Azure Repos

后续步骤Next steps