Skip to main content
Gitar analyzes failing TeamCity builds reported on a PR’s latest commit, using logs it can access from connected repositories. TeamCity Cloud and On-Premises use the same access-token setup. TeamCity must report the result for the commit it tested and include a link to that build. Gitar uses the report to find the logs. Saving a TeamCity connection in Gitar does not configure build-status reporting.

Prerequisites

  • Connect the repository to Gitar.
  • Use a Gitar organization Admin account to configure the integration.
  • Confirm TeamCity reports build results on your PRs. The Commit Status Publisher build feature is one way to configure this. Some GitHub App configurations publish checks automatically. Follow TeamCity’s instructions for your Git provider and verify that the reported result links to the individual build.
  • Create or use a TeamCity account with access to the projects Gitar should read. Ask a TeamCity administrator to create a dedicated account and assign its access if needed.
  • Confirm Gitar can reach the TeamCity server over HTTPS with a valid certificate. If it is reachable only through a VPN or private network, contact Gitar to confirm connectivity. IP allowlisting alone does not create a connection to a private network.

Setup

1

Give that user view access

Ask a TeamCity administrator to assign the default Project Viewer role on the projects Gitar should read. All Projects is available when access to the whole server is intended.The default role provides the read access needed for build logs. Broader roles can also work, but Gitar does not need permission to start builds or change configurations. If roles are customized, confirm that the account can open the intended builds and their logs.If the server does not use per-project permissions, ask its administrator to confirm the account’s effective access. A token restricted to selected projects must also include the project containing the build.A dedicated account keeps access separate from an individual team member. Limiting its access to selected projects also limits what Gitar can read.
2

Create an access token

Sign in as the TeamCity user whose access Gitar should use. Open your avatar menu and select Profile > Access Tokens. Older versions may label the profile entry My Settings & Tools.If Access Tokens or token creation is unavailable, ask a TeamCity administrator to check whether token-based authentication is enabled.Select Create access token, give it a name such as Gitar, and choose expiration according to your organization’s policy.Same as current user gives the token its owner’s permissions. If Limit per project is available, select the projects Gitar should read and use the Read-only preset. The token cannot grant access its owner does not have.Create the token, copy its generated value, and store it securely. TeamCity shows the value only during creation.
Replace the token in Gitar before it expires using Replace or revoke the token. An expired or removed token can no longer retrieve build logs.
3

Check the server URL TeamCity publishes

Ask a TeamCity administrator to open Administration > Global Settings and confirm Server URL is the address Gitar can reach. TeamCity uses this value when generating links. An internal-only address can leave Gitar unable to open the published build links.Use the server’s address, including https://, rather than a project or build-page URL. For example, use https://example.teamcity.com for TeamCity Cloud or https://ci.example.com for your own server. For private networks, confirm connectivity before setup. See Network access.
4

Connect TeamCity in Gitar

  1. Go to your Gitar organization settings.
  2. Open Integrations.
  3. Find TeamCity and click Connect.
  4. Paste the access token into TeamCity Access Token.
  5. Set TeamCity Server URL to your server base URL, https://<tenant>.teamcity.com on Cloud or your own host on-premises.
  6. Select Connect to save.
Saving stores the token without testing it against TeamCity. A configured integration does not confirm that the token is valid or can read build logs. Follow Verify log access.
Gitar compares the server name in each build link with the configured TeamCity Server URL and ignores statuses pointing to a different server.

Verify log access

Check the next failing TeamCity build reported on the PR’s latest commit. Follow its status link and confirm that it opens the expected build. Check the PR’s dashboard comment for Gitar’s analysis. Repeat for projects with different access permissions. Use the build link TeamCity publishes, such as https://ci.example.com/buildConfiguration/MyProject_Build/12345 or https://ci.example.com/viewLog.html?buildId=12345&buildTypeId=MyProject_Build. A project or build-configuration page without a specific build does not identify logs Gitar can fetch.

What Gitar reads and fixes

Gitar reads logs from failing builds and posts its analysis in the PR’s dashboard comment. It ignores failure events for older commits after new commits arrive. With auto-apply enabled, Gitar can push code fixes for failures confirmed as caused by the PR. With auto-apply disabled, comment Gitar fix CI to request a fix. See CI failure analysis for fix conditions and recovery behavior. Gitar does not start or retry TeamCity builds. A code fix may start another build if your configuration runs after a push.

Replace or revoke the token

Create a replacement token from the same TeamCity user’s Profile > Access Tokens, with access to the required projects. In Gitar, open Settings > Integrations, find TeamCity, and select Configure. Replace TeamCity Access Token and select Update. Verify log access before removing the old token. To remove the old token, return to the same user’s Profile > Access Tokens page in TeamCity and remove that token. Older versions may label the profile entry My Settings & Tools. To stop Gitar’s access, remove the token Gitar is using from that user’s Access Tokens page. Removing an old token after saving a replacement does not revoke access through the replacement.

Troubleshooting

Confirm that the repository is connected to Gitar and check the PR’s latest commit for a TeamCity status check. Follow its link to the specific build, rather than a project or build-configuration overview.If there is no status, check TeamCity’s build-status reporting for your Git provider. If you use Commit Status Publisher, confirm it is configured for this build configuration and that its Git-provider credential can write statuses on the repository. This is separate from the TeamCity token Gitar uses to read logs.A build link opening in your browser does not guarantee Gitar recognizes it. If reporting uses a short link such as /build/12345, configure it to publish one of the supported build-link formats shown in Verify log access.If the status is there, check that the server name in TeamCity Server URL matches the build link. Gitar ignores statuses pointing to another server.If automatic processing is disabled, follow that setting’s instructions to start Gitar. For an earlier failure, comment Gitar fix CI to request analysis.
Check whether the token has expired or been removed under the owning user’s Profile > Access Tokens. Follow Replace or revoke the token if a replacement is needed.Sign in as that user and open the affected build’s log. If access is denied, ask an administrator to check the user’s project permissions. Also check any Limit per project restrictions on the token. Browser access through the user account alone does not prove that a restricted token can retrieve the log.If only the user’s role needs changing, you do not need a new token, provided its own restrictions still allow the required access.
If TeamCity is hosted under a path such as https://example.com/teamcity and logs cannot be retrieved despite working access, keep the complete published build link and contact Gitar. Saving credentials does not verify support for this server configuration.
Access from your browser over a VPN does not prove that Gitar can reach TeamCity. If the server is reachable only on a private network, contact Gitar to confirm connectivity before setup. Saving credentials does not verify network or log access.See Network access.

Security notes

  • Gitar encrypts credentials and stores them in AWS Secrets Manager.
  • Prefer a dedicated user’s token over a personal one, so access survives people leaving.
  • The default Project Viewer role is read-only. Gitar writes nothing to TeamCity.
  • Scope the role to the projects Gitar should read, if the whole server is more than you want to grant.
  • To revoke Gitar’s access, remove the token it is using from the owning user’s Profile > Access Tokens. See Replace or revoke the token.

TeamCity references