YouTrack Standalone 2018.3 Help

Integrate with TeamCity

Follow the instructions on this page to integrate your YouTrack project with a build configuration in TeamCity. The integration between YouTrack and TeamCity enables the following features in your project:

  • Pull build numbers from connected projects and automatically update the values in custom fields that store build numbers for resolved issues. Build numbers in YouTrack are appended with an icon that provides direct access to the build in TeamCity.

    fixed in TeamCity build

  • Add direct links to change details in VCS commits.

  • Apply commands to issues in commit messages when TeamCity assembles a build that contains the commit.

Prerequisites

Before you start, verify the following requirements:

  • You have a user account in TeamCity that is assigned the Project Administrator role in the projects that you want to integrate with YouTrack. If your TeamCity server uses simple authorization mode, Administrator permissions are required.

  • The YouTrack project that you want to integrate with TeamCity uses a custom field that stores a value as a build type. You can use the default custom field Fixed in build or any other custom field that stores a build type.

    If you don't want to add build numbers to issues, you can enable the integration without mapping build numbers to a custom field in YouTrack. In this case, your developers can still mention issues and apply commands in VCS commit messages.

Connect to a TeamCity Server

To enable the integration in your project, YouTrack needs a connection to at least one TeamCity server. If you have sufficient permissions in TeamCity, you can establish the connection yourself.

To connect to a TeamCity server, you need permission to View project and all parent projects and Modify user profile and roles. Access to these permissions is based on the authorization mode that is used by your TeamCity server.

Authorization Mode

Access Requirements

Simple

The default Administrator role has both of the permissions that are required for the integration.

Per-project

The default Project viewer role has permission to View project and all parent projects. The default Project developer and Project administrator roles include permissions for the Project viewer by default. The permission to Modify user profile and roles is not included and must be added to the role that is assigned to your account. Roles can be assigned to your account directly or at the group level.

For more information about roles and permissions, refer to the TeamCity documentation.

If you don't have these permissions in TeamCity, a YouTrack administrator can configure the connection. For details, see TeamCity Integration.

If YouTrack is already integrated with the TeamCity server that processes builds that contain references to your project, skip this step and define the mapping for your project.

To connect to a TeamCity server:

  1. Click the Projects link in the header to open the Projects list.

  2. From the Administration menu for your project, select Build Server Integration.

    project administration build server integration

  3. From the Add New Mapping menu, select Add build server.
    add build server in project
    • The Add Build Server dialog opens in the sidebar.

    add TeamCity server
  4. Enter values for the following settings:

    Setting

    Description

    URL

    Enter the URL of the TeamCity server.

    Type

    Select TeamCity.

    Login

    Enter the username of the TeamCity user account.

    Password

    Enter the password for the TeamCity user account.

  5. Expand the Advanced settings section and configure the following optional settings:

    Setting

    Description

    Select SSL key

    If the TeamCity server uses a secure connection and you have uploaded an SSL client key to authenticate your YouTrack service, select the client key from the drop-down list. For more information, see SSL Keystores.

    Socket timeout

    Set the maximum amount of time to wait for a response from the TeamCity server before disconnecting the socket. The default is 30 seconds.

    Read timeout

    Set the maximum amount of time to wait for complete data transfer from the TeamCity server before closing the connection. The default is 30 seconds.

  6. Click the Test connection button.
    • YouTrack verifies the connection to the TeamCity server.

  7. Click the Add server button.
    • The TeamCity server connection settings are saved.

Repeat these steps to add connections to additional TeamCity servers.

Define the Mapping Between Projects

To enable the TeamCity integration in your project, you map your YouTrack project to a build configuration in TeamCity.

The first group of settings connect YouTrack to a build configuration for a project on a TeamCity server. Additional options for the default and feature branches let you define which issues are assigned build numbers for each branch. You can also specify the commands to apply to all of the issues that are processed by YouTrack.

To define a mapping between YouTrack and TeamCity:

  1. On the Build Server Integration tab of the Edit Project page, select a Jenkins server in the list of build server integrations.

  2. Click the Create New Mapping button.
    • The Create Mapping dialog opens in the sidebar.

      new TeamCity mapping

  3. Enter values for the following settings:

    Setting

    Description

    TeamCity Server

    Select the TeamCity server that contains the project that you want to map to. If you are only connected to one TeamCity server, it is set by default.

    TeamCity Project

    Select the name of the project in TeamCity.

    TeamCity Build

    Select a build configuration from the selected TeamCity project.

    Process changes

    Choose how YouTrack handles VCS changes in builds that are processed by TeamCity. The following options are available:
    • Do not attach — VCS changes that include references to YouTrack issue IDs are not added to the activity stream in the referenced issue. Use this option when you only want the integration to add build numbers to custom fields.

    • Attach — VCS changes that include references to YouTrack issue IDs are added to the activity stream in the referenced issue. The entry in the activity stream contains a link to the build that contains the change. The commit message is not parsed for YouTrack commands.

    • Attach and apply commands — VCS changes that include references to YouTrack issue IDs are added to the activity stream in the referenced issue. The entry in the activity stream contains a link to the build that contains the change. The commit message is also parsed for YouTrack commands.

    Visible to

    To restrict the visibility of comments and updates that are shown as VCS changes in the activity stream, select one or more groups from the list. Otherwise, this activity type is visible to any user who has permission to read issues in the project.

    Parse commits for issue comments

    To detect and generate issue comments from commit messages, enable this option. Otherwise, the entire commit message is displayed with the VCS change in the issue activity stream.

    To learn more about how YouTrack processes commit messages, see Apply Commands in VCS Commits.

  4. Click to expand the Actions for Default Branch settings. These settings determine which actions are applied to builds in the default branch.

    actions for default branch
    If you don't want to add build numbers to issues, continue from step 8.

  5. Configure the following options:

    Option

    Description

    Consider failed builds

    Enable to add build numbers to issues for all builds, including failed builds. When disabled, only successful builds are added to issues in YouTrack.

    Process issues mentioned in commits and build comments

    Enable to add build numbers to issues that are mentioned in commits and build comments. When disabled, YouTrack ignores mentioned issues. Use this setting together with the Query setting to determine which issues are assigned build numbers.

    Query

    Enter a search query to add build numbers to issues that match a specific filter criteria. The standard search query is State: Fixed State: Verified resolved date: ${build.time}..${prev.build.time}. This query ensures that only issues that are resolved since the last successful build and the current build are considered. Use this setting together with the Process issues mentioned in commits and build comments option to determine which issues are assigned build numbers.

    Command

    Enter a command that is applied to all issues that are assigned build numbers in YouTrack. Use the ${build} variable to reference the build number in TeamCity. For example: Subsystem Testing Test in build ${build} With this command, all issues that are processed by YouTrack are assigned to the Testing subsystem and the Test in build field is set to the build number.

    Build Field

    Select the custom field that stores the build number from TeamCity.

    Add builds to the set of values

    Enable to automatically add build numbers to the set of values for the selected custom field. The builds that are considered for this option are affected by the Consider failed builds setting.

  6. Expand and set the options for the Actions for Feature Branches settings. These settings determine which actions are applied to builds in one or more feature branches. Each setting provides the same functionality as described for the default branch, above.

  7. Click the Create mapping button.
    • The YouTrack project is mapped to the selected project in TeamCity.

    • The TeamCity integration is enabled and available for use in your YouTrack project.

Placeholders

You can use placeholders in the Query and Command settings. These placeholders reference attributes that are stored for builds in TeamCity. The placeholder is replaced with the corresponding value in the connected version control system when the builds are processed by YouTrack. The following placeholders are available:

Placeholder

Description

${build.time}

The date and time of the build that is processed by YouTrack.

${prev.build.time}

The date and time of the build prior to the build that is processed by YouTrack.

${build}

The number of the build that is processed by YouTrack.

${revision}

The revision number that is assigned to a VCS commit.

Last modified: 30 November 2018

See Also