Icon

You are viewing the documentation of TeamCity 9.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 2018.x documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 
Skip to end of metadata
Go to start of metadata

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 projects can be created automatically or manually. At the top of the projects hierarchy, TeamCity has the default <Root project> containing all other projects. 

Create a project automatically from URL

Creating your first build is extremely easy with the Create project from URL option which supports Git, Mercurial, and Subversion, and partially TFS, Perforce, and Vault.

  1. Use the Administration link in the top right corner to go to the Administration area and click Create project from URL.
  2. Paste the repository URL of you project into the field. The URL formats are listed here. If required, specify your repository credentials.


    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.


    Next TeamCity will scan your VCS repository and autodetect your build steps. Check the steps and use them in your build configuration. 

    The selected build step is added to the the build configuration.
  4. 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 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.
  2. Specify the project's name, ID (autogenerated, modifiable) and an optional description. Click Create:

  3. When a project is created, TeamCity prompts to populate it with build configurations, which can be created automatically from URL (similarly to creating projects from URL) or manually as described below. Click Create build configuration.
  4. Specify the build configuration name, ID, description. Click Create

  5. 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 and click Create. Specify the required information (name and URL), test your connection and click Create. 



    If your project resides in several version control systems, you can attach as many VCS Roots to it as you need. For example, if you store a part of your project in Perforce, and the rest in Git, you need to create and attach 2 VCS roots - one for Perforce, another for Git. Learn more about configuring VCS roots.

    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.
    After the build configuration is created, its settings are displayed on the left.
     

  6. Now you can configure Build steps: select the corresponding setting on the left, click Add build step and select a build runner from the drop-down.

     Fill in the required fields and save the build step. 



  7. 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, but you can add as many steps as you like and reorder them if required. You can add steps manually (1) or ask TeamCity to detect them automatically.

TeamCity will also suggest settings (2), such as triggers, failure conditions, and build features. Depending on the build configuration settings, it may prompt some additional options. You can follow the suggestions and add the settings to configure your build. You can always tweak the settings after running your first build.

Now you can launch your first build by clicking Run (3) in the upper right corner of the TeamCity web UI:



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.

 

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:



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.


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:

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

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 .

Build Number Format

Each build in TeamCity has a build number, which is a string identifier composed according to the pattern specified on the General settings page of your build configuration (the field is available on clicking the show advanced options link). 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!

(todo-add suggested settings)

  • No labels