我正在尝试在 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,或者这是否正确并且该行为是一个错误?谷歌搜索错误消息导致只有两个匹配项没有任何答案:
最佳答案
目前,无法从 DSL 本身更改版本化设置配置。如果我们允许,那么可能会出现一些不平凡的问题。因此您不能更改当前正在与 VCS 同步的项目的同步选项。您也无法在 DSL 从其他 VCS 存储库生成的某些子项目中启用与其他 VCS 根目录的同步。基本上,这是先有鸡还是先有蛋的问题,因此存在局限性。
关于teamcity - 如何使用 TeamCity DSL versionedSettings 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70260012/