Triggering a Kotlin DSL Upgrade

My company has recently upgraded to version 2022.04 but we've been having some issues with the Kotlin DSL following this major release. We use the `jetbrains/teamcity-server:2022.04.2` docker conainer to host our implementation and we use Kotlin DSL to configure all of our pipelines from the root project down. We mount a docker volume for `/data/teamcity_server/datadir` and `/opt/teamcity/logs`. We have found that the Kotlin DSL fails to compile when we run the process on the server, however, if I locally start the same docker container without the volume mounts and use the exact same DSL code it works perfectly.

We have tried changing the classpaths over but to no avail. I don't think that should have had any effect anyway. There's a few errors in our server logs but they don't seem to relate to this issue. When we brought up the docker container, we found that the documentation page at `app/dsl-documentation/index.html` showed an error `Kotlin DSL API documentation is not initialized yet` which seemed to suggest that the packages were being created. This did eventually start showing the expected documentation but even after this, the DSL throws numerous errors.

The errors DSL throws are regarding unresolved references for classes like `vcsRoot` and `buildType` which are referred using the new style paths, e.g. `import jetbrains.buildServer.configs.kotlin.*`.

I suspect that if I were to remove the volume mount then I would be able to use the DSL, since at that point it would be identical to the local docker image I use, but in doing so we'd presumably lose the parameters stored within the Teamcity datadir.

I was hard pushed to find any information at all on this issue anywhere so I'm open to any suggestions.


UPDATE: I've removed both the volumes we had on the container. Even with this being the case - that there was no attached volume on the container at all - the DSL still failed to compile. So the issue doesn't appear to be the content of the mounts rather the issue lies elsewhere. So I took a look at the environment variables. We define SERVER_URL and TEAMCITY_SERVER_MEM_OPTS. The SERVER_URL is pretty standard but the other had a few bits that aren't exactly common. So I tried removing those options and the DSL worked! 

The value I had removed was as follows:

"-Xmx4g -XX:ReservedCodeCacheSize=350m -Dteamcity.versionedSettings.configsGeneratorTimeoutSeconds=1200 -Dteamcity.configsDsl.runInSameProcess=true"

I'm going to do some testing and figure out what made it stop working. See you all soon!

1 comment
Comment actions Permalink

Yep, the problem was `-Dteamcity.configsDsl.runInSameProcess=true` I can't find any documentation on this particular variable so I've removed it. Must've been hunting for a solution...


Please sign in to leave a comment.