Agent Pool project assignment via Kotlin DSL
Hi, we recently switched to Kotlin for all our pipelines. Is there possibility to programmatically assign specific projects to specific agent pools?
Ideally I would see it as a property in a jetbrains.buildServer.configs.kotlin.Project class but as I can see there is not such thing.
Please sign in to leave a comment.
Hi,
You're correct — currently, there is no direct property in the Project class (i.e., jetbrains.buildServer.configs.kotlin.Project) that allows assigning agent pools at the project level via the Kotlin DSL.
While it's not possible to assign agent pools through the Project DSL, you can still restrict compatible agents using requirements inside a BuildType:
requirements {
equals("agent parameter", "value")
}
If you're using templates, this logic can be centralized and applied to multiple build configurations across a project.
Alternatively, you can assign agent pools to projects programmatically via the REST API. For more details, refer to the documentation: Manage Projects Associated with Pool (TeamCity REST API).
Best Regards,
Tom
Thanks, went with REST API :)