Created
January 10, 2020 12:33
-
-
Save antonarhipov/684ee96d1430a38403e8765e63af61b0 to your computer and use it in GitHub Desktop.
TeamCity Kotlin DSL - using type inheritance for settings reuse in build configurations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jetbrains.buildServer.configs.kotlin.v2019_2.* | |
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script | |
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot | |
version = "2019.2" | |
project { | |
vcsRoot(ProjectVcs) | |
buildType(BuildA) | |
buildType(BuildB) | |
} | |
object ProjectVcs : GitVcsRoot({ | |
name = "ProjectVcs" | |
url = "git://some.git.repository" | |
}) | |
//--------------------------------------------------------------------------- | |
open class MyCommonTemplate : BuildType({ | |
steps { | |
script { | |
scriptContent = """echo "Hello from base template" """ | |
} | |
} | |
}) | |
object BuildA : MyCommonTemplate() { | |
init { | |
name = "BuildA" | |
steps { | |
script { | |
scriptContent = """echo "More steps for A" """ | |
} | |
} | |
} | |
} | |
object BuildB : MyCommonTemplate() { | |
init { | |
name = "BuildB" | |
steps { | |
script { | |
scriptContent = """echo "More steps for B" """ | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment