- Enable versioned settings for your project.
- Select kotlin as the format.
Commit the settings to your version control.
Prior to TeamCity 2017.2, as soon as a project is switched to Kotlin, editing of its settings is disabled in the UI (except a few pages: Versioned settings, Maven Settings, SSH keys and Meta-runners). If you need to enable editing, switch versioned settings to XML format or disable versioned settings.
Since TeamCity 2017.2, project and build configuration settings will be available for editing from the web UI. See details below.
Once you apply the versioned settings to your project, TeamCity will generate necessary Kotlin files for this project and check them in to the specified repository under theIf this repository already contains project settings in the XML format, they will be preserved, but TeamCity will no longer use them: once you get familiar with Kotlin files, these xml files can be removed.
The easiest way to experiment with DSL in TeamCity 2017.2+ is to edit settings in UI and check the UI diff script generated by TeamCity.
Since TeamCity 2017.2 after After Kotlin DSL is enabled for a project, the TeamCity server provides html documentation for the core DSL API as well as the API provided by installed TeamCity plugins. The online documentation is available on your local server, accessible via the link on the Versioned Settings project tab in the UI or by running the
mvn -U dependency:sources command in the IDE. See an example.
.teamcity/settings.ktsscript defining a project hierarchy. All ids in portable scripts are relative to the project where versioned settings were enabled, they are expanded to the full id during DSL execution. In portable Portable DSL there is has no restriction on a directory name for project settings. All settings can be moved to a single file.