teamcity - 如何使用 TeamCity DSL versionedSettings 功能?

标签 teamcity config dsl

我正在尝试在 TeamCity DSL 中配置一个项目,我希望能够为该项目指定 versionedSettings,否则我必须在导入/创建项目后在 UI 中手动编辑版本设置。

这是我尝试使用的示例配置:

version = "2021.2"

project {
    vcsRoot(TheVCS)

    features {
        versionedSettings {
            mode = VersionedSettings.Mode.ENABLED
            allowEditingOfProjectSettings = false
            settingsFormat = VersionedSettings.Format.KOTLIN
            buildSettingsMode = VersionedSettings.BuildSettingsMode.PREFER_SETTINGS_FROM_VCS
        }
    }
}

object TheVCS : GitVcsRoot({
    name = "TheVcs"
    url = "https://git.repo/1234"
    userNameStyle = UserNameStyle.NAME
    branch = "refs/heads/main"
    branchSpec = "+:refs/heads/(*)"
    checkoutPolicy = AgentCheckoutPolicy.NO_MIRRORS
})

为此配置生成 XML (mvn teamcity-configs:generate) 将导致:

[ERROR] Error while generating TeamCity configs:
[ERROR] Validation error: Project 'RootProjectId', project feature [1/1]: Versioned settings project feature cannot be used in relative project hierarchy

我是否需要以某种其他方式指定 versionedSettings,或者这是否正确并且该行为是一个错误?谷歌搜索错误消息导致只有两个匹配项没有任何答案:

https://youtrack.jetbrains.com/issue/TW-63818

https://youtrack.jetbrains.com/issue/TW-66066

最佳答案

目前,无法从 DSL 本身更改版本化设置配置。如果我们允许,那么可能会出现一些不平凡的问题。因此您不能更改当前正在与 VCS 同步的项目的同步选项。您也无法在 DSL 从其他 VCS 存储库生成的某些子项目中启用与其他 VCS 根目录的同步。基本上,这是先有鸡还是先有蛋的问题,因此存在局限性。

关于teamcity - 如何使用 TeamCity DSL versionedSettings 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70260012/

相关文章:

asp.net - TeamCity 构建任务以自动启动 ASP.NET 网站

azure - _CleanGetCurrentAndPriorFileWrites 在 Teamcity 上失败

c# - CS0411 : The type arguments for method X cannot be inferred from the usage when building with TeamCity

java - Camel 拆分器返回 ExpressionNode

Scala 编译器无法推断类型参数

maven - 我可以包含 mvn deploy :deploy-file in the pom or settings. xml 而不是 cli 目标吗

git - 如何在 .git/config 中指定带有空格的 Git merge 驱动程序路径?

ubuntu - session 管理器 KDE 配置文件

path - 我如何找出 rubocop 使用的是哪个配置文件?

java - DSL-Json @compiledJson bean 实例化错误