包管道:单一配置

我们将从最简单的情况开始,在这种情况下,我们只需要构建1个配置,并且该配置可以在当前的CI机器上构建。

正如我们之前在介绍不同服务器二进制仓库时所描述的,包构建的理念是默认只使用develop仓库,该仓库被认为是开发人员和CI任务的稳定仓库。

此管道从一个干净状态开始,缓存中没有包,并且只启用了develop仓库。

通过此配置,CI任务可以执行以下操作:

$ cd ai
$ conan create . --build="missing:ai/*"
...
ai/1.1.0: SUPER BETTER Artificial Intelligence for aliens (Release)!
ai/1.1.0: Intelligence level=50

请注意,在某些情况下,--build="missing:ai/*"可能不是完全必要的,但在其他情况下可以节省时间。例如,如果开发人员只更改了仓库的README,而没有提升版本,Conan将不会生成新的recipe revision,并将其检测为无操作,从而避免不必要地从源代码重新构建二进制文件。

如果我们处于单一配置场景且构建正确,对于这种简单情况,我们不需要晋升(promotion),只需将已构建的包直接上传到products仓库即可,products pipeline稍后会选取它。

# We don't want to disrupt developers or CI, upload to products
$ conan remote enable products
$ conan upload "ai*" -r=products -c
$ conan remote disable products

由于缓存最初是干净的,所有ai包都将是在此管道中构建的。

digraph repositories { node [fillcolor="lightskyblue", style=filled, shape=box] rankdir="LR"; subgraph cluster_0 { label="Packages server"; style=filled; color=lightgrey; subgraph cluster_1 { label = "packages\n repository" shape = "box"; style=filled; color=lightblue; "packages" [style=invis]; } subgraph cluster_2 { label = "products\n repository" shape = "box"; style=filled; color=lightblue; "products" [style=invis]; "ai/1.1.0\n (single config)"; } subgraph cluster_3 { rankdir="BT"; shape = "box"; label = "develop repository"; color=lightblue; rankdir="BT"; node [fillcolor="lightskyblue", style=filled, shape=box] "game/1.0" -> "engine/1.0" -> "ai/1.0" -> "mathlib/1.0"; "engine/1.0" -> "graphics/1.0" -> "mathlib/1.0"; "mapviewer/1.0" -> "graphics/1.0"; "game/1.0" [fillcolor="lightgreen"]; "mapviewer/1.0" [fillcolor="lightgreen"]; } { edge[style=invis]; "packages" -> "products" -> "game/1.0" ; rankdir="BT"; } } }

这是一个非常简单的场景,让我们转向一个更真实的场景:必须构建多个配置。