Ampelofilosofies

homeaboutrss
The mind is like a parachute. If it doesn't open, you're meat.

Tales of Teamcity: Failures in Kotlin

31 Mar 2020

This is part of a series of posts documenting my ongoing adventures in TeamCity, starting at Tales of Teamcity: Adventures in Kotlin

Kotlin is cool. I am a fool.

These two sentences are both true. The best aggro moment of the last three days was when I spent over two hours trying to figure out why the following script failed:

import jetbrains.buildServer.configs.kotlin.v2019_2.*

version = "2019.2"

project {
  description = "TeamCity as Code"

  buildType(Experiment)
}

object Experiment : BuildType({
  name = "experiment"

  vcs {
    root(DslContext.settingsRoot)
  }

  steps {
    script {
        name = "Docs"
        scriptContent = "rake doc:gaudi"
    }
  }
})

I even went as far a posting an issue on the TeamCity support site. And then I went to bed, slept through the night, looked at the code again this morning and remembered I am writing code in a JVM language.

So I added

import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script

at the top.

Remember, I am a professional and I have been doing this for 25 years.

It helps that your TeamCity instance hosts the DSL reference at app/dsl-documentation/index.html. It also helps to read said reference.

But mostly, it helps when you just go to bed and try again when you’re fresh.


The response to my brain-dead-due-to-lack-of-sleep support request came as I was writing this. Response time less than 16 hours. I am liking this.