- TeamCity settings format changes
- Versions in DSL code
- DSL upgrade procedure
- Update DSL from 2017.1.x to 2017.2.x
- Update DSL from 10.0.x to 2017.1.x
The TeamCity XML settings format is usually changed in the major releases. During the first start after the server update, TeamCity converts XML settings files in the TeamCity Data directory to the new format.
When settings are stored in Kotlin DSL, the Kotlin code might need to be changed to still be functional. It is also recommended to update the Kotlin code to the latest config version with each version.
These recommendations are reported as server health reports and are shown in corresponding locations on the server administration UI.
TeamCity settings format changes
As far as the DSL is concerned, there are the following types of TeamCity settings changes.
Changes which can be performed automatically
These types of settings changes do not require changing the Kotlin DSL as the changes are applied by the server automatically on each settings regeneration from the DSL. It is recommended though to update the DSL to newer configs version to reduce performance hit and make Kotlin scripts closer to the settings you see in UI.
A lot of changes in TeamCity settings fall within this category. For example, some plugin implementing a build step can rename its parameters. The DSL from the previous TeamCity version generates a parameter with an old name, but TeamCity can automatically replace the old parameter name with the new one after DSL execution.
Changes which cannot be performed automatically
Some TeamCity settings changes require external information and cannot be performed automatically. For example, in TeamCity 10.0 the settings of the cloud integration were stored in a dedicated file which was not committed to VCS. In TeamCity 2017.1 these settings were moved to the project level. TeamCity cannot perform such a transformation of settings automatically without external data,so manual DSL code update is required.
Versions in DSL code
Maven dependency version
This is the version specified in pom.xml, it looks like this:
It needs to be updated to the version of the TeamCity server you use.
Kotlin DSL API version
This is the version included in the Kotlin DSL API package name:
jetbrains.buildServer.configs.kotlin.v10. New backward-incompatible API will be provided in a new package and the API from older versions will continue to work.
The version specified in
settings.kts, it looks like this:
version = "10.0"
TeamCity uses this version to decide which transformations should be performed after DSL execution to make settings up-to-date.
DSL upgrade procedure
After TeamCity upgrade, the versioned settings are disabled globally on the whole TeamCity server and a corresponding health report is shown in the administration UI. This is done to prevent TeamCity from changing the settings in the version control if you upgrade a non-production copy of the TeamCity server.
If the server is a production installation, enable versioned settings using the action in the health report. This will make TeamCity commit converted XML file to the VCS. For settings in Kotlin format the files inside plugin-settings directory and meta-runners will be committed.
At this point, the version control has the previous version of Kotlin DSL scripts.
If some of the settings conversions cannot be applied automatically, TeamCity will disable the versioned settings for the affected projects and a corresponding health report is shown. You should update the DSL as per the notes below and then the versioned settings can be enabled in the project.
For the projects with settings in Kotlin DSL which were not affected by the settings conversions or if the settings can be converted automatically, the Kotlin DSL scripts do not require any immediate changes and you can continue using the projects as usual (versioned settings stay enabled in such projects). However, it is recommended to update the Kotlin scripts to the up-to-date configs version. TeamCity displays a health report for each affected project with instructions on how to update DSL. In order to check if DSL code update is required, load the settings from VCS and see the Current status on the Versioned settings tab: it will show a warning if update is required.
Update DSL from 2017.1.x to 2017.2.x
This release introduces the new DSL API version,
v2017_2. The previous API version works and you can keep using it if you do not need the features provided by the new API.
If you used 2017.2 EAPs and tested changing DSL settings via the UI, you need to apply all the UI patches created by TeamCity before upgrading as some API is changed in an incompatible way.
The current package name for the settings generated by TeamCity is
With the new API, you can benefit from a number of new features, including the editable administration UI for Kotlin DSL projects and DSL documentation. To use them for your existing project, your
.kt files should be switched to packages from the
- To compile this project, you also need to update your pom.xml. The easiest way is to invoke the Download settings in Kotlin format action in your project and copy the
pom.xmlfrom the generated zip archive. Alternatively you can update pom.xml yourself with the following:
- change the teamcity.dsl.version to:
change the kotlin version to:
<kotlin.version>1.1.4-3</kotlin.version>and add a dependency on kotlin-runtime and kotlin-reflect:
- change the teamcity.dsl.version to:
Once you switch the project to new API and check in the changes, TeamCity will detect and apply them and after that web UI editing will be enabled.
To use the new DSL API in a repository with an existing p
om.xml, the maven dependency version has to be updated to
Updating Docker parameters
If you used Kotlin DSL with TeamCity 2017.1 for Docker plugin configurations, you may need to perform some changes in your kotlin configuration scripts to make your code compatible with TeamCity 2017.2. Basically, TeamCity provides a converter for Kotlin configuration scripts to perform those changes automatically, but if it does not work due to some reason, the following changes need to be made manually:
- rename the build runner step with the Docker Build runType to DockerBuild
- rename the build runner step with the Docker Compose runType to DockerCompose
- rename the docker-compose.file build parameter to dockerCompose.file
Updating default project template
Since 2017.2 EAP3 TeamCity supports default templates in projects. This setting was stored in a project feature of the "DefaultTemplate" type in EAP3 and EAP4, but since 2017.2 RC the project configuration schema was changed to accommodate for default templates.
To manually convert a DSL project configuration that employs the default template, you will have to delete a corresponding project feature and replace it with the defaultTemplate property assignment as follows:
2017.2 EAP3/4 DSL project configuration with a default template configured:
2017.2 DSL project configuration with the default template configured:
Updating .NET CLI parameters
Since 2017.2 TeamCity bundles .NET CLI plugin. If you were using Kotlin DSL for the plugin parameters in TeamCity 2017.1.x, you need to change the commands as follows. In TeamCity 2017.1.x:
Since TeamCity 2017.2 you could explicitly specify build steps with parameters:
|dotnet-command||dotnet<Command>||Now the command name reflects the build step name, e.g. |
|dotnet-build-no-deps||-||Should be added as the |
|dotnet-build-not-incremental||-||Should be added as the |
dotnet nuget delete
dotnet nuget push
|dotnet-nuget-push-no-buffer||-||Should be added as the |
|dotnet-pack-serviceable||-||Should be added as the |
|dotnet-restore-ignore-failed||-||Should be added as the |
|dotnet-restore-no-cache||-||Should be added as the |
|dotnet-restore-parallel||-||Should be added as the |
|dotnet-restore-root-project||-||Should be added as the |
|dotnet-vstest-filter-type||filter||To filter tests by name, use |
|dotnet-vstest-is-isolation||-||Should be added as the |
Update DSL from 10.0.x to 2017.1.x
TeamCity 2017.1 does not introduce a new Kotlin DSL API, the same package as in TeamCity 10.0.x is used (
jetbrains.buildServer.configs.kotlin.v10). Several new properties were added to the existing API; to get the latest API for the scripts development, update
teamcity.dsl.version in pom.xml to the
2017.1-SNAPSHOT for EAP builds and to the
2017.1 for release builds.
Changes requiring manual Kotlin DSL scripts update
These changes should be performed before enabling versioned settings in the projects where they were disabled on TeamCity upgrade with the message: "Versioned settings are disabled in this project because its settings files were modified during TeamCity upgrade"
Converting cloud profiles
This is only relevant if you use Kotlin DSL for the Root project settings and have cloud profiles.
In 2017.1 cloud profiles were moved from the server level to the Root project level. Since they were not defined in the Kotlin DSL, in case you enable the versioned settings the existing cloud profiles will be deleted form he server. Thus before continuing to use Kotlin DSL fr the root project on the server make sure to add the cloud profiles definitions to the root project settings in Kotlin DSL.
To update your settings with the cloud profile information, perform the following:
- Run the 'Download settings in Kotlin format' action in the Root project and save the zip with the generated DSL
- Copy project features of type "CloudIntegration" and "CloudProfile" from the
.teamcity/_Root/Project.ktfile to the root project config in your settings
- Commit your changes to the VCS
- Enable versioned settings on the 'Versioned Settings' tab of the Root project.
Names in entities
Due to the fix of issue TW-48609, if your settings contain nameless entities, TeamCity will report corresponding VCS settings errors. You need to manually set a name parameter to such entities to resolve the errors.
Updating Kotlin DSL configs version to 10.0 to 2017.1
The changes in this section should be done to Kotlin scripts on changing the scripts config version from 10.0 to 2017.1
Updating DotCover parameters
Parameters used by DotCover were changed and if you use them, make sure the "
dotNetCoverage.tool" has the "dotcover" value. If the "
dotNetCoverage.dotCover.home.path" parameter is missing, set it to
"%teamcity.tool.JetBrains.dotCover.CommandLineTools.bundled%". The result should look like this:
If you use DotCover with custom path (e.g.
/custom/path), then the result should look like this:
Updating Maven build step parameters
If you use a typed maven DSL without raw parameters, then this change should not affect you, because typed DSL generates up-to-date settings.
If you specify maven build runner settings via the
param("name", "value") method, then parameters need to be updated. The easiest way to update settings is to switch to the typed DSL: you can generate settings in the Kotlin format to see what the typed DSL for Maven looks like.
If you want to continue using the
param("name", "value") method, do the following:
- rename the "
mavenSelection"parameter to "
maven.path", change its old value to the new one:
Old value to be changed
the value of the
- remove the
Updating PowerShell build step parameters
TeamCity 2017.1 adds support for cross-platform PowerShell. Previously PowerShell builds used only the Desktop edition and were run only on Windows.
To ensure that the existing builds remain restricted to the Desktop edition of PowerShell, set the following property in the existing PowerShell steps:
or if you use raw parameters: