src/pin-build/src.main.kts [29:51]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun getServerInstance(): TeamCityCoroutinesInstance { val builder = TeamCityInstanceBuilder(requiredInput("server_url")) val accessToken = input("access_token") val server = when { accessToken.isNotEmpty() -> builder.withTokenAuth(accessToken) else -> builder.withGuestAuth() }.build() return server } fun requiredInput(name: String) = System.getenv("input_$name") ?: error("Input '$name' is not set.") fun input(name: String) = System.getenv("input_$name") ?: "" fun runCatchingWithLogging(block: () -> Unit) = runCatching(block).onFailure { fun writeMessage(text: String, vararg attributes: Pair) = println(asString(MESSAGE, mapOf("text" to text, *attributes))) fun writeDebug(text: String) = writeMessage(text, TAGS_ATRRIBUTE to "tc:internal") fun writeError(text: String) = writeMessage(text, "status" to "ERROR") writeError("$it (Switch to 'Verbose' log level to see stacktrace)") writeDebug(it.stackTraceToString()) kotlin.system.exitProcess(1) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src/tag-build/src.main.kts [30:52]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun getServerInstance(): TeamCityCoroutinesInstance { val builder = TeamCityInstanceBuilder(requiredInput("server_url")) val accessToken = input("access_token") val server = when { accessToken.isNotEmpty() -> builder.withTokenAuth(accessToken) else -> builder.withGuestAuth() }.build() return server } fun requiredInput(name: String) = System.getenv("input_$name") ?: error("Input '$name' is not set.") fun input(name: String) = System.getenv("input_$name") ?: "" fun runCatchingWithLogging(block: () -> Unit) = runCatching(block).onFailure { fun writeMessage(text: String, vararg attributes: Pair) = println(asString(MESSAGE, mapOf("text" to text, *attributes))) fun writeDebug(text: String) = writeMessage(text, TAGS_ATRRIBUTE to "tc:internal") fun writeError(text: String) = writeMessage(text, "status" to "ERROR") writeError("$it (Switch to 'Verbose' log level to see stacktrace)") writeDebug(it.stackTraceToString()) kotlin.system.exitProcess(1) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -