Skip to content

Example settings.kts

netwolfuk edited this page Jul 1, 2025 · 3 revisions

This example shows how the webhooks stored as Kotlin DSL.

project {
    features {
        webHookConfiguration {
            webHookId = "id_572883493"
            template = "legacy-json"
            url = "http://localhost:58001/auth/200"
            buildTypes = selectedProjectBuilds {
                subProjectBuilds = true
                /* Define the specific buildTypes that this webhook should execute for.
                 * There are 3 ways to define a buildType.
                 *
                 *     This function takes an object of type "jetbrains. buildServer. configs. kotlin.BuildType".
                 *     Typically, the buildType will already be defined in this file, and we can just reference it.
                 * buildType(myBuildType)
                 *
                 *     This function takes the id of the BuildType. Again, we already know the buildType config, so
                 *     we can use that by calling toString() on it.
                 * buildTypeId(myBuildType.id.toString())
                 *
                 *     This example calls the same function, but we are hard coding the BuildType's ID string.
                 *     This is the least preferred method as it would need to be updated if the ID changes.
                 * buildTypeId("MyProjectId_MyBuildTypeId")
                 */
                
                buildTypeId{"RootProjectId_TcWebHooks"}
                buildTypeId{"RootProjectId_TcDummyDeb"}
            }
            buildStates {
                buildStarted = true
                changesLoaded = true
                buildInterrupted = true
                beforeBuildFinish = true
                buildSuccessful = true
                buildFailed = true
                responsibilityChanged = true
            }
            authentication = bearer {
                token = "${test.thing1}"
                preemptive = true
            }
            headers {
                header("zxc", "zxczxczxcxzc")
            }
            parameters {
                parameter(
                    name = "color",
                    value = "red",
                    secure = false,
                    forceResolveTeamCityVariable = false,
                    includedInLegacyPayloads = true,
                    templateEngine = "STANDARD"
                )
                parameter(
                    name = "notify",
                    value = "1",
                    secure = false,
                    forceResolveTeamCityVariable = false,
                    includedInLegacyPayloads = true,
                    templateEngine = "STANDARD"
                )
                parameter(
                    name = "branchName",
                    value = "${branchDisplayName}",
                    secure = false,
                    forceResolveTeamCityVariable = true,
                    includedInLegacyPayloads = true,
                    templateEngine = "VELOCITY"
                )
            }
        }
    }
}
Clone this wiki locally