Skip to end of metadata
Go to start of metadata

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:

<teamcity.dsl.version>10.0.4</teamcity.dsl.version>.

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.

Configs version

The version specified in settings.kts, it looks like this:

version = "10.0"
project(Some_Project)

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

DSL version

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.

Icon

To get sample DSL code for the newly supported features without switching a project to the Kotlin format, use the Download settings in Kotlin format action on the project administration page.

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 jetbrains.buildServer.configs.kotlin.v2017_2.

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 v2017_2 version

  • 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.xml from the generated zip archive. Alternatively you can update pom.xml yourself with the following:
    • change the teamcity.dsl.version to: <teamcity.dsl.version>2017.2</teamcity.dsl.version>
    • change the kotlin version to:<kotlin.version>1.1.4-3</kotlin.version> and add a dependency on kotlin-runtime and kotlin-reflect:

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 pom.xml, the maven dependency version has to be updated to 2017.2.

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

Starting from TeamCity 2017.2, the Docker plugin has its own typed DSL for the Docker build feature, Docker Wrapper, Docker Build, and Docker Compose runners.

Docker Compose and Docker Build
Docker Build Feature
Command Line runner with Docker Wrapper

 

 

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:

Common parameters

2017.12017.2Comment
dotnet-commanddotnet<Command>Now the command name reflects the build step name, e.g. dotnetRestore
dotnet-argsargs 
dotnet-verbositylogging 

dotnet build

2017.12017.2Comment
dotnet-pathsprojects 
dotnet-build-configconfiguration 
dotnet-build-frameworkframework 
dotnet-build-outputoutputDir 
dotnet-build-runtimeruntime 
dotnet-build-no-deps-Should be added as the --no-dependencies argument
dotnet-build-not-incremental-Should be added as the --no-incremental argument

dotnet clean

2017.12017.2
dotnet-pathsprojects
dotnet-clean-configconfiguration
dotnet-clean-frameworkframework
dotnet-clean-outputoutputDir
dotnet-clean-runtimeruntime

dotnet msbuild

2017.12017.2
dotnet-pathsprojects
dotnet-msbuild-configconfiguration
dotnet-msbuild-platformplatform
dotnet-msbuild-targetstargets
dotnet-msbuild-runtimeruntime

dotnet nuget delete

2017.12017.2
dotnet-nuget-delete-idpackageId

dotnet-nuget-push-source /

dotnet-nuget-delete-source

packageSource
secure:dotnet-nuget-delete-api-keyapiKey

dotnet nuget push

2017.12017.2Comment
dotnet-pathspackages 
dotnet-nuget-push-sourcepackageSource 
dotnet-nuget-push-no-symbolsnoSymbols 
secure:dotnet-nuget-push-api-keyoutputDir 
dotnet-build-runtimeapiKey 
dotnet-nuget-push-no-buffer-Should be added as the --disable-buffering true argument

dotnet pack

2017.12017.2Comment
dotnet-pathsprojects 
dotnet-pack-configconfiguration 
dotnet-pack-runtimeruntime 
dotnet-pack-no-buildskipBuild 
dotnet-pack-outputoutputDir 
dotnet-pack-version-suffixversionSuffix 
dotnet-pack-serviceable-Should be added as the --serviceable argument

dotnet publish

2017.12017.2
dotnet-pathsprojects
dotnet-publish-configconfiguration
dotnet-publish-frameworkframework
dotnet-publish-outputoutputDir
dotnet-publish-runtimeruntime
dotnet-publish-version-suffixversionSuffix

dotnet restore

2017.12017.2Comment
dotnet-pathsprojects 
dotnet-restore-configconfigFile 
dotnet-restore-runtimeruntime 
dotnet-restore-packagespackagesDir 
dotnet-restore-sourcepackageSources 
dotnet-restore-ignore-failed-Should be added as the --ignore-failed-sources argument
dotnet-restore-no-cache-Should be added as the --no-cache argument
dotnet-restore-parallel-Should be added as the --disable-parallel argument
dotnet-restore-root-project-Should be added as the --no-dependencies argument

dotnet run

2017.12017.2
dotnet-pathsprojects
dotnet-run-configconfiguration
dotnet-run-frameworkframework
dotnet-run-runtimeruntime

dotnet test

2017.12017.2
dotnet-pathsprojects
dotnet-test-configconfiguration
dotnet-test-frameworkframework
dotnet-test-no-buildskipBuild
dotnet-test-outputoutputDir
dotnet-test-settings-filesettingsFile
dotnet-test-runtimeruntime
dotnet-test-test-case-filterfilter

dotnet vstest

2017.12017.2Comment
dotnet-pathsassemblies 
dotnet-vstest-config-filesettingsFile 
dotnet-vstest-frameworkframework 
dotnet-vstest-platformplatform 
dotnet-vstest-filter-typefilterTo filter tests by name, use name { names = "..." }; for the test case filter, use filter { filter = "..." }
dotnet-vstest-is-isolation-Should be added as the /InIsolation argument

 

 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:

  1. Run the 'Download settings in Kotlin format' action in the Root project and save the zip with the generated DSL
  2. Copy project features of type "CloudIntegration" and "CloudProfile" from the .teamcity/_Root/Project.kt file to the root project config in your settings
  3. Commit your changes to the VCS
  4. 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

New value

mavenSelection:bundledM2

%teamcity.tool.maven%

mavenSelection:bundledM3_0

%teamcity.tool.maven3%

mavenSelection:bundledM3_1

%teamcity.tool.maven3_1%

mavenSelection:bundledM3_2

%teamcity.tool.maven3_2%

mavenSelection:bundledM3_3

%teamcity.tool.maven3_3%

mavenSelection:default

%teamcity.tool.maven.AUTO%

mavenSelection:custom

the value of the maven.home parameter.

 

  • remove the maven.home parameter.

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:














 

  • No labels