I've extracted my Teamcity builds as Kotlin outputs. I want to create a base class that defines a number of common steps/settings, but allow individual builds to extend these properties.
e.g.
open class BuildBase(init: BuildBase.() -> Unit) : BuildType({
steps {
powerShell {
name = "Write First Message"
id = "RUNNER_FirstMessage"
scriptMode = script {
content = """
Write-Host "First Message"
""".trimIndent()
}
}
}
})
object Mybuild : BuildBase({
steps { // This would add a new step to the list, without wiping out the original step
powerShell {
name = "Write Last Message"
id = "RUNNER_LastMessage"
scriptMode = script {
content = """
Write-Host "Last Message"
""".trimIndent()
}
}
}
})
In this example, I want to inherit the step from the base class, but add additional steps relevant to the specific build. Additionally, I'd want to inherit the base disableSettings
(if any) and disable other steps.
Is this even possible? if so, how would I go about structuring the classes to enable it?