CommitStatusPublisher

A build feature publishing status to external system.

Example. Publishes build statuses to GitHub.com / GitHub Enterprise. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = github {
githubUrl = "<GitHub URL, https://api.github.com for github.com>"
authType = personalToken { // authType = password { ... } to use username and password
token = "credentialsJSON:*****"
}
}
}
}
}

Example. Publishes build statuses to GitHub.com / GitHub Enterprise. Uses the credentials of the VCS root.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = github {
githubUrl = "<GitHub URL, https://api.github.com for github.com>"
authType = vcsRoot()
}
}
}
}

Example. Publishes build statuses to GitHub.com / GitHub Enterprise. Uses a GitHub App installation token stored in TeamCity.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // A VCS root must be specified to use this authentication type
publisher = github {
githubUrl = "<GitHub URL, https://api.github.com for github.com>"
authType = storedToken {
tokenId = "tc_token_id:*****"
}
}
}
}
}

Example. Publishes build statuses to GitHub.com / GitHub Enterprise. Sets the buildName value as a status check name displayed in the status message posted to the VCS.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // A VCS root must be specified to use this authentication type
publisher = github {
githubUrl = "<GitHub URL, https://api.github.com for github.com>"
statusCheckName = "Customized GitHub status check name" // optional, can be used for branch protection rules
authType = storedToken {
tokenId = "tc_token_id:*****"
}
}
}
}
}

Example. Publishes build statuses to GitLab.com / GitLab CE/EE. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = gitlab {
gitlabApiUrl = "https://<GitLab URL>/api/v4" // optional, the URL will be composed based on the VCS root fetch URL if omitted (https://gitlab.com/api/v4 for gitlab.com)
accessToken = personalToken { // authType = vcsRoot() to take credentials from the VCS root
accessToken = "credentialsJSON:*****"
}
}
}
}
}

Example. Publishes build statuses to GitLab.com / GitLab CE/EE. Instead of personal token authentication a refreshable access token stored in TeamCity is used. Sets the buildName value as build name displayed in the status message posted to the VCS.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = gitlab {
jobName = "Customized GitLab status job name" // optional
gitlabApiUrl = "https://<GitLab URL>/api/v4" // optional, the URL will be composed based on the VCS root fetch URL if omitted (https://gitlab.com/api/v4 for gitlab.com)
authType = storedToken {
tokenId = "tc_token_id:*****"
}
}
}
}
}

Example. Publishes build statuses to Bitbucket Cloud. The password must be Bitbucket App password generated by user. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = bitbucketCloud {
authType = password { // authType = vcsRoot() to take credentials from the VCS root
userName = "<username>"
password = "credentialsJSON:*****"
}
}
}
}
}

Example. Publishes build statuses to Bitbucket Cloud. Instead of password authentication an access token stored in TeamCity is used. Sets the buildName value as build name displayed in the status message posted to the VCS.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = bitbucketCloud {
buildName = "Customized Bitbucket Cloud status build name" // optional
authType = storedToken {
tokenId = "tc_token_id:*****"
}
}
}
}
}

Example. Publishes build statuses to Bitbucket Server / Data Center. The password can be either user's password (not recommended) or Bitbucket HTTP access token generated by user. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = bitbucketServer {
url = "<Bitbucket Server Base URL>" // optional, the URL will be composed based on the VCS root fetch URL if omitted
authType = password { // authType = vcsRoot() to take credentials from the VCS root
userName = "<username>"
password = "credentialsJSON:*****"
}
}
}
}
}

Example. Publishes build statuses to Bitbucket Server / Data Center. Instead of password authentication an access token stored in TeamCity is used. Sets the buildName value as build name displayed in the status message posted to the VCS.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = bitbucketServer {
buildName = "Customized Bitbucket Server / Data Center status build name" // optional
url = "<Bitbucket Server Base URL>"
authType = storedToken {
tokenId = "tc_token_id:*****"
}
}
}
}
}

Example. Publishes build statuses to Azure DevOps. For now only personal access token authentication type is supported. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = azureDevOps {
serverUrl = "<Azure DevOps URL>" // optional
authType = personalToken {
accessToken = "tc_token_id:*****"
}
publishPullRequests = true // optional
}
}
}
}

Example. Publishes build statuses to Azure DevOps. Instead of password authentication an access token stored in TeamCity is used. Sets the buildName value as build name displayed in the status message posted to the VCS.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = azureDevOps {
buildName = "Customized Azure DevOps status build name" // optional
serverUrl = "<Azure DevOps URL>" // optional
authType = storedToken {
tokenId = "tc_token_id:*****"
}
publishPullRequests = true // optional
}
}
}
}

Example. Enables publishing build statuses to Perforce P4 Code Review (Helix Swarm). For now only personal access token authentication type is supported. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = swarm {
serverUrl = "<Swarm URL>"
username = "<username>"
token = "credentialsJSON:*****"
createSwarmTest = true // optional, if set, TeamCity will create a test run on the P4 Code Review (Helix Swarm) server and update its status according to the build status in TeamCity.
commentOnEvents = true // optional
}
}
}
}

Example. Enables voting in Gerrit based on build statuses.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = gerrit {
server = "<Gerrit server URL>"
gerritProject = "<Gerrit project name>"
label = "<label>" // e.g. Verified
failureVote = "<failed build vote>" // e.g. -1
successVote = "<successful build vote>" // e.g. +1
userName = "<username>"
uploadedKey = "<SSH key name>"
}
}
}
}

Example. Enables publishing build statuses to JetBrains Upsource. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.

buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
        commitStatusPublisher {
vcsRootExtId = "${<VCS root object>.id}" // optional, publishes to all attached git VCS roots if omitted
publisher = upsource {
serverUrl = "<Upsource URL>"
projectId = "<Upsource project id>"
userName = "<username>"
password = "credentialsJSON:*****"
}
}
}
}

See also

Constructors

Link copied to clipboard
constructor(init: CommitStatusPublisher.() -> Unit)
constructor()

Types

Link copied to clipboard

Properties

Link copied to clipboard

Specifies whether the feature is enabled, true by default

Link copied to clipboard
var id: String?

Build feature id, if not specified will be generated

Link copied to clipboard
Link copied to clipboard

The type of the VCS provider to which the build status should be published.

Link copied to clipboard

Build feature type

Link copied to clipboard

Id of the VCS root for which commits a status should be published. Set to an empty string to publish status for all VCS roots attached to a build configuration.

Link copied to clipboard
Link copied to clipboard

Build feature type in yaml

Functions

Link copied to clipboard

Publish build statuses to Azure DevOps / TFS.

Link copied to clipboard
Link copied to clipboard

Publish build statuses to Bitbucket Server / Data Center.

Link copied to clipboard
fun booleanParameter(customName: String? = null, trueValue: String? = "true", falseValue: String? = "false"): DelegateProvider<Boolean>
fun booleanParameter(customName: String? = null, trueValue: String? = "true", falseValue: String? = "false", yamlName: String? = null): DelegateProvider<Boolean?>
Link copied to clipboard
fun clear()
Link copied to clipboard
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null): DelegateProvider<T>
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null, yamlName: String? = null): DelegateProvider<T>
Link copied to clipboard
fun <T : Parametrized> copyParamsTo(target: T): T

Copies parameters of this object to the specified target

Link copied to clipboard
open fun create(): BuildFeature

Creates an instance of this build feature via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.

Link copied to clipboard
fun doubleParameter(customName: String? = null): DelegateProvider<Double>
fun doubleParameter(customName: String? = null, yamlName: String? = null): DelegateProvider<Double>
Link copied to clipboard
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null): DelegateProvider<E>
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null, yamlName: String? = null): DelegateProvider<E>
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null, yamlName: String? = null, yamlMapping: Map<E, String?>? = null): DelegateProvider<E>
Link copied to clipboard
fun findRawParam(paramName: String): Parameter?
Link copied to clipboard

Publish status to Gerrit Code Review.

Link copied to clipboard

Publish build statuses to GitHub.

Link copied to clipboard

Publish build statuses to GitLab.

Link copied to clipboard
fun hasParam(paramName: String): Boolean
Link copied to clipboard
fun intParameter(customName: String? = null): DelegateProvider<Int>
fun intParameter(customName: String? = null, yamlName: String? = null): DelegateProvider<Int>
Link copied to clipboard
fun param(name: String, value: String)

Adds parameter with specified name and value

Link copied to clipboard
fun removeRawParam(paramName: String)
Link copied to clipboard

Publish build statuses to JetBrains Space.

Link copied to clipboard
open fun stringParameter(customName: String? = null): DelegateProvider<String>
open fun stringParameter(customName: String? = null, yamlName: String? = null): DelegateProvider<String>
Link copied to clipboard

Publish build statuses to Perforce P4 Code Review (Helix Swarm).

Link copied to clipboard

Publish build status to Azure DevOps / TFS.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
Link copied to clipboard
open override fun validate(consumer: ErrorConsumer)

Validates this object and reports found errors to the provided consumer