TeamCity 2017.1 Help

Configure and Run Your First Build

After you installed and started TeamCity as described here, the server is accessible locally on the default port (on Windows as http://localhost/, and on Linux/ OS X as http://localhost:8111/) and has one registered build agent that runs on the same computer.

Now we can get building! This section describes how you can:

Create your first project

In TeamCity there is the default <Root project> containing all other projects in TeamCity.

To create a project, use the Administration link at the top right corner.

There are several options to create a project:

Create a project pointing to repository URL

This is the fastest way to create your first build.

  1. Use the Administration link in the top right corner to go to the Administration area and click Create project and select Pointing to repository URL.

    01create projectfrom url
  2. Paste the repository URL of you project into the field. The URL formats are listed here. If required, specify your repository credentials.

    02create project provide url

    Click Proceed and follow the wizard.

  3. TeamCity will do the rest for you: it will identify the type of the VCS repository, test the connection and auto-configure VCS repository settings, as well as suggest the project and build configuration names. Click Proceed.

    03create bc name
  4. Next TeamCity will scan your VCS repository and autodetect your build steps. Check the boxes of the steps and use them in your build configuration.

    04build steps auto detect

    The selected build step is added to the the build configuration.

  5. Congratulations! You've configured your first build containing one build step. Now you can run your build and tweak its settings if necessary.

Create a project pointing to GitHub.com repository

  1. Click the Create project button and select Pointing to GitHub.com repository.

    From gh0

  2. The Connections page with the Add connection dialog opens. The provides the parameters to be used when registering your TeamCity application in GitHub service. Click the register TeamCitylink.

    From gh1 add
  3. The GitHub page opens. You need to register TeamCity as an OAuth application in GitHub. The following steps are performed in your GitHub account:

  4. Log into your GitHub account. On the Register a new OAuth application page specify the name (and an optional description), the homepage URL and the callback URL as provided by TeamCity. Use the From gh0 copy icon to copy the required parameters.

    From gh1 register app
  5. Click Register application. The page is updated with Client ID and the client secret information for your TeamCity application.

    From gh1 add client id secret
  6. Continue configuring the connection in TeamCity: on the Add Connection page, specify the Client ID and the client secret.

    From gh1 add client id secret
  7. Save your settings.

  8. Next you need to authorize TeamCity in the VCS: click Sign in to GitHub:

    From gh1 sign in2gh
  9. On the page that opens, authorize the TeamCity application:

    From gh1 authorize tc
  10. The authorized application will be granted full control of private repositories and the Write repository hooks permission in GitHub.

    Now you have a connection configured and you can continue with creating your project in TeamCity: All the repositories available to the user will be listed. Start typing to filter the list and select the required repository:

    From gh1 repo select

  11. TeamCity will verify the repository connection. If the сonnection is verified, the Create Project page opens. TeamCity will display the project and build configuration name. If required, modify the names and click Proceed.

    03create bc name
  12. Next TeamCity will scan your VCS repository and autodetect your build steps (it may take some time). Check the boxes of the steps and use them in your build configuration.

    04build steps auto detect

    The selected build step is added to the the build configuration.

  13. Congratulations! You've configured the GitHub connection and your first build containing one build step. Now you can run your build and  tweak its settings if necessary.

When the connection is configured, a small GitHub icon becomes active in several places of the UI where a repository URL can be specified (create project from URL, create a build configuration from URL,  create VCS root from URL, create Git VCS root, create GitHub issue tracker for the current project and all of its subprojects), making it easier to create these entities in TeamCity.

Create a project manually

You can create a project manually if auto-detection of settings is not suitable for you.

  1. Use the Administration link in the top right corner to go to the Administration area and click Create project and select Manually.

    11create project manually
  2. Specify the project's name, ID (autogenerated, modifiable) and an optional description. Click Create:

    12project create man name

When a project is created, TeamCity prompts to populate it with build configurations, which can be created automatically (similarly to creating projects) or manually as described below. Click Create build configuration and select Manually:

13create bc

  1. Specify the build configuration name, ID(autogenerated, modifiable) and an optional description . Click Create.

    14create bc name

  2. Next TeamCity offers to create and attach a new VCS Root: to be able to create a build, TeamCity has to know where the source code resides, and a VCS root is a collection of VCS settings (paths to sources, login, password, and other settings) that defines how TeamCity communicates with a version control (SCM) system to monitor changes and get sources for a build. Each build configuration has to have at least one VCS root attached to it. A VCS root can be created automatically or manually. To create it manually, select the type of VCS from the drop-down (Git in the example below), s pecify the required information (name and URL), test your connection and click Create.

    15create vcs

    After you have created a VCS root, you can instruct TeamCity to exclude some directories from checkout, or map some paths (copy directories and all their contents) to a location on the build agent different from the default one. This can be done by means of checkout rules. You can also specify whether you want TeamCity to checkout the sources on the agent or server. Note that the agent-side checkout is supported not for all VCSs, and in case you want to use it, you need to have a version control client installed on at least one agent.

    14a root created

    After the VCS Root is created, the build configuration settings are displayed on the left.

  3. Now you can configure  Build steps by selecting the corresponding setting on the left. You can either instruct TeamCity to automatically detect the build steps after scanning your repository or configure build steps manually as described in this example. Click Add build step and select a build runner from the drop-down.

    16select build step

    Fill in the required fields and save the build step.

    17build step configure
  4. Congratulations! You've configured your first build containing one build step. Now you can run your build and  tweak its settings if necessary.

Run your first build

Your build currently has one build step and you can now launch your first build by clicking Run in the upper right corner of the TeamCity web UI:

18arun build
You will be redirected to the build result page, where you can watch the build progress and review its results upon the build finishing. You can also access your build configuration settings from this page and edit them as required.
22build results

Tweak your build configuration settings

You might want to configure the following settings:

Artifacts

If your build produces installers, WAR files, reports, log files, etc. and you want them to be published on the TeamCity server after finishing the build, you can specify the paths to such artifacts in the General Settings section of Build configuration settings:

23artifact paths

As you have a finished build, the build agent has checkout the sources already and the Artifact paths field has the checkout directory browser. You can select artifacts from the tree and TeamCity will place the paths to them into the input field.

24artifact paths zip
Save your settings. Now when we run a build, TeamCity will put the required reports into an archive. The build configuration home page lists all builds that were run and enables you to view the available artifacts:
25build results artifacts home

You can also view and download artifacts from the build results page:

26build results artifacts tab
More details are available in the dedicated section of our documentation.

Automatic Build Trigger

You can instruct TeamCity to trigger a build automatically every time it detects a change in the version control: go to the Triggers section of your build configuration settings and configure the VCS trigger .

27trigger

Build Number Format

Each build in TeamCity has a build number, which is a string identifier composed according to the pattern specified on theGeneral settings page of your build configuration (the field is available on clicking the show advanced optionslink). You can leave the default value here, in which case the build number format will be maintained by TeamCity and will be resolved into a next integer value on each new build start. More details are available in the dedicated section of our documentation.

Happy building!

Last modified: 20 April 2023