我有一个 TeamCity 构建配置,直到最近它一直运行良好。突然,有一个构建卡在队列中,说它与任何代理都不兼容。给出的理由是:
Implicit requirements: teamcity.build.branch defined in Parameter: BuildFormatSpecification
我的 BuildFormatSpecification 参数是这样定义的:
%MajorVersion%.%MinorVersion%.%PatchVersion%-%teamcity.build.branch%
这又在 Build Number Format 字段中与构建计数器一起使用,如下所示:
%BuildFormatSpecification%.%sharedBuildNumber.id4%
这个想法是构建号像“1.0.0-develop.22”一样出现,并包括正在构建的 Git 分支。这遵循语义版本控制的规则。这个方案在很多项目中都对我有用,但是突然这个构建卡住了,我不知道为什么。
有什么想法吗?
最佳答案
teamcity.build.branch
是 predefined build parameter但它仅在 branch specification 时定义已配置。因此,要解决您的问题,请确保您的构建步骤配置了 VCS 根目录并添加例如+:refs/heads/(master)
作为你的分支规范。
来自 TeamCity 关于 Agent Requirements 的文档和隐含的要求:
Any reference (name in %-signs) to an unknown parameter is considered an "implicit requirement". That means that the build will only run on the agent which provides the parameters named.
Otherwise, the parameter should be made available for the build configuration by defining it on the build configuration or project levels.
https://stackoverflow.com/questions/22314229/