Packages pipeline  包管道 ¶

The packages pipeline will build, create and upload the package binaries for the different configurations and platforms, when some developer is submitting some changes to one of the organization repositories source code. For example if a developer is doing some changes to the ai package, improving some of the library functionality, and bumping the version to ai/1.1.0. If the organization needs to support both Windows and Linux platforms, then the package pipeline will build the new ai/1.1.0 both for Windows and Linux, before considering the changes are valid. If some of the configurations fail to build under a specific platform, it is common to consider the changes invalid and stop the processing of those changes, until the code is fixed.
包构建管道将为不同配置和平台构建、创建并上传包二进制文件,当开发者向组织仓库的源代码提交更改时。例如,如果开发人员对 ai 包进行修改,改进部分库功能并提升版本至 ai/1.1.0 。若组织需要同时支持 Windows 和 Linux 平台,则包构建管道会在考虑更改有效性之前,先为 Windows 和 Linux 分别构建新的 ai/1.1.0 版本。如果某些配置在特定平台上构建失败,通常会将这些更改视为无效并暂停处理,直至代码修复完成。

For the package pipeline we will start with a simple source code change in the ai recipe, simulating some improvements in the ai package, providing some better algorithms for our game.
对于 package pipeline ,我们将从 ai 配方中进行一个简单的源代码修改,模拟对 ai 包的一些改进,为我们的游戏提供一些更好的算法。

Let’s do the following changes in the ai package:
让我们在 ai 包中进行以下更改:

  • Let’s change the implementation of the ai/src/ai.cpp function and change the message from Some Artificial to SUPER BETTER Artificial
    让我们修改 ai/src/ai.cpp 函数的实现,并将消息从 Some Artificial 更改为 SUPER BETTER Artificial

  • Let’s change the default intelligence=0 value in ai/include/ai.h to a new intelligence=50 default.
    让我们将 intelligence=0 的默认值更改为新的 intelligence=50 默认值。

  • Finally, let’s bump the version. As we did some changes to the package public headers, it would be adviced to bump the minor version, so let`s edit the ai/conanfile.py file and define version = "1.1.0" there (instead of the previous 1.0). Note that if we did some breaking changes to the ai public API, the recommendation would be to change the major instead and create a new 2.0 version.
    最后,让我们升级版本。由于我们对包的公共头文件进行了修改,建议升级 minor 版本,因此请编辑 ai/conanfile.py 文件并在其中定义 version = "1.1.0" (替换之前的 1.0 )。需要注意的是,如果对 ai 公共 API 进行了破坏性更改,建议改为更改主版本号并创建一个新的 2.0 版本。

The packages pipeline will take care of building the different packages binaries for the new ai/1.1.0 and upload them to the packages binary repository to avoid disrupting or causing potential issues to other developers and CI jobs. If the pipeline succeed it will promote (copy) them to the products binary repository, and stop otherwise.
包构建管道将负责为新版本 ai/1.1.0 构建不同包的二进制文件,并将其上传至 packages 二进制仓库,以避免干扰其他开发者或引发潜在问题。若构建管道成功,将把二进制文件推广(复制)至 products 二进制仓库,否则构建将停止。

There are different aspects that need to be taken into account when building these binary packages for ai/1.1.0. The following tutorial sections do the same job, but under different hypothesis. They are explained in increasing complexity.
在为 ai/1.1.0 构建这些二进制包时,需要考虑多个不同方面。以下教程章节实现了相同目标,但基于不同假设。这些内容按复杂度递增顺序进行讲解。

Note all of the commands can be found in the repository run_example.py file. This file is mostly intended for maintainers and testing, but it might be useful as a reference in case of issues.
请注意,所有命令均可在仓库中的 run_example.py 文件中找到。该文件主要供维护人员和测试人员使用,但在遇到问题时也可作为参考。