Commit Status Publisher
Commit Status Publisher is a build feature which allows TeamCity to automatically send build statuses of your commits to an external system. The feature is implemented as an open-source plugin bundled with TeamCity.
The supported systems are:
GitHub (the build statuses for pull requests are supported as well)
GitLab
Azure DevOps (supported statuses: Pending, Succeeded, Failed, Error)
Bitbucket Server and Bitbucket Cloud
JetBrains Space
JetBrains Upsource
Gerrit Code Review tool 2.6+
Provider-specific Configuration
GitHub
Commit Status Publisher supports the GitHub URL in the following format:
For GitHub.com:
https://api.github.com
For GitHub Enterprise:
http[s]://<host>[:<port>]/api/v3
For connection, select one of the available authentication types:
- Access Token
Use a personal access token or obtain a token through an OAuth connection. The token must have the following scopes:for public repositories:
public_repo
andrepo:status
for private repositories:
repo
Password
Provide the GitHub username and password.
Note that the password authentication will not work if connecting to a GitHub Enterprise repository or if the user's GitHub account is protected with a two-factor authentication. In these cases, use an access token instead.
GitLab
If you use a recent version of GitLab (>= 9.0), it is recommended to use the GitLab URL of the following format: http[s]://<hostname>[:<port>]/api/v4
as GitLab stops supporting the v3 API in GitLab 11. If you have /api/v3
in your current TeamCity configurations, they may stop working with GitLab 11+, so consider changing the server URL to api/v4
.
For older versions of GitLab, use the GitLab URL of the format http[s]://<hostname>[:<port>]/api/v3
.
Bitbucket Cloud
To be able to connect to Bitbucket Cloud, make sure the TeamCity server URL is a fully qualified domain name (FQDN): for example, http://myteamcity.domain.com:8111
. Short names, such as http://myteamcity:8111
, are rejected by the Bitbucket API.
In the Commit Status Publisher settings, specify a username and password (or token) for authentication. For Bitbucket Cloud team accounts, it is possible to use the team name as the username and the API key as the password.
Bitbucket Server
Commit Status Publisher supports the Bitbucket Server URL in the following format: http[s]://<hostname>:<port>
. Apart from the URL, you need to specify a username and password (or token) for authentication.
Azure DevOps
Personal access tokens can be used for authentication. If a VSTS connection is configured, the personal access token can be automatically filled from the project connection.
JetBrains Space
To configure integration with JetBrains Space, follow the steps below.
In JetBrains Space:
Go to Administration | Applications and click New application.
Select the Service Account type of the application and enter a convenient name (for example, TeamCity-to-Space publisher ).
Click Edit requested rights and enable the Git Repositories | Push commit status permission.
Click Create to save the application.
In the application list, select your new application and copy its autogenerated Client ID and Client secret.
In Project Settings | Applications of your Space project, add the TeamCity application to the list of authorized apps.
In TeamCity:
- In the project’s settings:
In VCS Roots, configure a VCS root pointing to your Space repository.
In Connections, add a connection with the JetBrains Space type.
- Enter the connection name and Space settings:
URL of the Space server.
Client ID of your Space application.
Client secret of your Space application.
- In the build configuration’s settings:
In Build Features, add the Commit status publisher build feature.
Select the JetBrains Space publisher and the recently created connection.
Specify the name that will be displayed for this service in Space.
Save the settings.
Now, whenever you run a build in this configuration, TeamCity will report the build status to JetBrains Space.
Gerrit
Commit Status Publisher supports Gerrit versions 2.6+. For configuring integration with earlier Gerrit versions, contact our support.
Using Commit Status Publisher
Add the build feature to your build configuration.
Use the default All attached VCS roots option if you want Commit Status Publisher to attempt publishing statuses for commits in all attached VCS roots or select a single repository for publishing build statuses.
Select your system as the publisher and specify its connection details and credentials.
Test the connection
Save your settings.
Example: Configuring Pull Requests Status Publishing to GitHub
The example below demonstrates how to configure sending the status of builds with changes included in your pull request from TeamCity to GitHub.
Use pull requests build feature to configure pull requests branches. Alternatively you can make the branches available by configuring the branch specification in your VCS Root while ensuring that it includes pull requests branches (see also a related blog post ).
Add the Commit Status Publisher build feature:
Use the default All attached VCS roots option to publish statuses for commits in all attached VCS roots
Select GitHub as the publisher and specify its connection details and credentials and test the connection:
Save your settings.
Commit changes to your source code and create a pull request in GitHub, then run a build with your changes in TeamCity. The Commit Status Publisher will inform you on the status of the build with your pull request changes:
- It will show you whether the check is:
in progress
failed
successful
hovering over the commit status will display the build summary
clicking the build status icon or the Details link will open the build results page in TeamCity. This information is also available on the Commits tab of your pull request details.
Similarly to the previous page, clicking the build status icon opens the build results page in the TeamCity web UI:
- It will show you whether the check is: