-
Notifications
You must be signed in to change notification settings - Fork 28
KotlinDSL Format
netwolfuk edited this page Jul 23, 2025
·
7 revisions
Since tcWebHooks-3.0.0-alpha.1
Since 3.0.0, WebHooks are defined in TeamCity as ProjectFeatures. We define project features in TeamCity's Kotlin DSL inside our project's settings.kts
file. Within this file we need to place them in the features
block, which is in turn located within the project
block.
// TeamCity Project definition
project {
// Features are defined within a project
features {
// webhooks are defined as features.
webHookConfiguration {
// webhook definition
}
webHookConfiguration {
// a second webhook definition
}
}
}
The minimum attributes required are webHookId
template
, url
, buildTypes
, and buildStates
.
webHookConfiguration {
/*
* webHookId must be unique across all of teamcity.
* A simple way to guarantee this is to base the name on the current project, and use a number
*/
webHookId = "MyProject_WebHook_01"
/*
* template refers to the ID of a template.
* The Template ID is at the top of the template page for viewing a template.
*/
template = "legacy-json"
/*
* url is the web address of where to deliver the webhook POST request.
*/
url = "http://localhost:8111/webhooks/endpoint.html?vcs_test=1"
/*
* buildTypes define which builds will trigger this webhook
* There are two functions that return a buildTypes object. They are 'allProjectBuilds' and 'selectedProjectBuilds'
*/
buildTypes = allProjectBuilds {
subProjectBuilds = true
}
/*
* buildStates define which stage(s) of the build lifecycle will trigger this webhook
* Specifying a buildState as false, or omitting it from config will prevent the
* webhook from sending for that state.
*/
buildStates {
// one or more of the following:
buildAddedToQueue = true
buildRemovedFromQueue = true
buildAddedToQueue = true
buildRemovedFromQueue = true
buildStarted = true
changesLoaded = true
buildInterrupted = true
beforeBuildFinish = true
buildSuccessful = true
buildFailed = true
buildFixed = true
buildBroken = true
responsibilityChanged = true
buildPinned = true
buildUnpinned = true
testsMuted = true
testsUnmuted = true
serviceMessageReceived = true
}
/*
*
*/
authentication = bearer {
token = "new-bearer-token"
preemptive = true
}
}
- Home
- Installing
- Configuration
- Templates
- Parameters (aka Variables)
- Example Webhook output
- WebHooks REST API