kotlin DSL reference?

Answered

I'm eager to use the new kotlin DSL, but I can't find any reference or even reliable examples. The only thing I found is this: https://confluence.jetbrains.com/display/TCD10/Kotlin+DSL, but it's the simplest example. Beside actual DSL reference I have questions like 'what do I do with my (secret) access keys?'

1
11 comments

Hello Marcin,

We are working on a better documentation for Kotlin DSL, but it is not ready yet, so unfortunately there is no tutorial at this point.

 

Regarding storing password in Version Settings, please see the section: https://confluence.jetbrains.com/display/TCD10/Storing+Project+Settings+in+Version+Control#StoringProjectSettingsinVersionControl-SecurityImplications. You can save secret keys on the project from the above level. Is it what you were looking for?

0
Avatar
Permanently deleted user

It's been six months since this post, and I'm still unable to find any references on what is available in TeamCity as far as steps, features, etc. through Kotlin/DSL.  

For example, I know there are 7 or 8 features available to a build through the GUI, but I have no clue how to reference those features through code.  There was one example in a tutorial for cleaning files, which I was able to get to work, but had it not been explicitly demonstrated, how are we supposed to know how to code the configuration?  

The only possibility I've found is to create a trash config, load it with every conceivable feature/build step, and then export it as Kotlin, but I don't even have the option to export as Kotlin.  And again, no reference to why that might be missing or how to resolve it.  

It appears my options at this point is either don't transition to the DSL model, build our pipelines on XML (and then start from scratch once docs are available), or start looking into other platforms that provide the necessary support to actually utilize these tools.

2

Hello,

In the latest TeamCity versions you can open project or build configuration and use Action > Download setting in Kotlin format option to download settings. Please see the series of posts in the oficial TeamCity blog: https://blog.jetbrains.com/teamcity/2016/11/kotlin-configuration-scripts-an-introduction/.

0
Avatar
Permanently deleted user

I'm assuming that there is still no actual documentation since you jumped straight to my proposed work around, is that correct?

In regards to my workaround, as mentioned in my post, I've already read that tutorial, but I don't have that option. I'm on version 10.0.2. Was it introduced in a later version? Again, it doesn't elude to when that was introduced, which is anther careless oversight in my opinion. I was speaking with a colleague who told me they had the same issue once, and had to enable or somehow, but they could not remember what it was they had to do.

Than you for your help.

3

I'm also struggling to find documentation on the TeamCity-specific Kotlin DSL.  It's very frustrating as the only way I've been able to figure out issues is to create a parallel project that for which I regenerate the Kotlin as I try to add new features to my main project.

Is there a plan to release proper documentation for the DSL?

Thanks!

1

Hello,

 

I'm in similar boots as those spoken earlier: I would very much like to experiment with my TeamCity builds using Koltin. I have found the confluence page useful and have also read the blog posts, which are enough to get me excited but not really enough to get me started.

 

In particular, I am new to Koltin and even Java. I managed to save a mock-project from TeamCity as Kotlin code and now I would like to modify it and add to it. However, when I commit new code to my .teamcity folder, I am only getting error messages (as expected) in TeamCity. I would appreciate having to do this very basic type of trial-and-error development locally, without having to commit code and then let TeamCity tell me the errors. So I have dowloaded the Kotlin compiler for linux and I am (as expected) getting error messages as certain TeamCity libraries are not readily available on my local machine.

For example:

"Project.kt:3:15: error: unresolved reference: buildTypes

import Kotlin.buildTypes.*
^
Project.kt:4:15: error: unresolved reference: vcsRoots
import Kotlin.vcsRoots.*

^
Project.kt:5:15: error: unresolved reference: vcsRoots

 

What do you recommend I should start with? I would like to have a reference to, e.g., what member functions and data state are available in BuildType? I can find no documentation on that. Also, how do I set up (make accessible) to my command line kotlin compiler the TeamCity buildType and other classes? In general, what is the recommended way to debug TeamCity Kotlin DSL code?

 

Thanks,

Jozsef

2

I am also getting all these unresolved errors when I am editing the TeamCity settings locally.
The setup went fine and IntelliJ downloaded the kotlin-dsl from the build server.

But it seems that it does not download everything?

Here are some example namespaces, which work on commit, but they are missing from the downloaded dsl:
jetbrains.buildServer.configs.kotlin.v10.vcs.GitVcsRoot
jetbrains.buildServer.configs.kotlin.v10.triggers.finishBuildTrigger

What can I do to get the complete dsl into the IntelliJ project?

1
Avatar
Permanently deleted user

Is there still no documentation for the kotlin DSL?

0
Avatar
Permanently deleted user

I found the following as a DSL reference documentation:

https://teamcity.jetbrains.com/app/dsl-documentation/jetbrains.build-server.configs.kotlin.v2017_2/index.html

Insert your teamcity version number into the URL for docs matching your version.

0

In TeamCity 2017.2+, after Kotlin DSL is enabled for a project, TeamCity provides the online documentation on your local server accessible via the link on the Versioned Settings project tab in the UI or by running mvn -U dependency:sources in the IDE. Here is the documentation on the public TeamCity server as an example.

You can also use the Download settings in Kotlin format option (available since TeamCity 10.0.3) from the project Actions menu. For instance, you can find (create) a project that defines some settings that you want to use in your Kotlin DSL project and use this "download" action to see what the DSL generated by TeamCity looks like.

Note that since TeamCity 2018.1 the portable Kotlin DSL format is used by default.

0

The latest DSL reference for the latest TeamCity version can be found here: https://teamcity.jetbrains.com/app/dsl-documentation/index.html

1

Please sign in to leave a comment.