TeamCity 8.0 Help

Pre-Tested (Delayed) Commit

An approach which prevents committing defective code into a build, so the entire team's process is not affected.

See also diagrams at the http://www.jetbrains.com/teamcity/features/delayed_commit.html.

The submitted code changes first go through testing. If the code passes all of the tests, TeamCity can automatically submit the changes to the version control. From there, the changes will automatically be integrated into the next build. If any test fails, the code is not committed, and the submitting developer is notified. Developers test their changes by performing a remote run. A pre-tested commit is enabled when the commit changes if successful option is selected.

The pre-tested commit is initiated via a plugin to one of Supported Platforms and Environments (also a command-line tool is Command Line Remote Run Tool).

For Git and Mercurial the recommended way to use Branch Remote Run Trigger approach to run personal builds off branches. Automatic after-the-build merge is supported since 8.1, see TW-16054.

Matching changes and build configurations To submit changed files to pre-tested commit or remote run, TeamCity should be able to check that the files, when committed, will affect the build configurations on the server.

If TeamCity cannot match the changes with the builds, a message "Submitted changes cannot be applied to the build configuration" is displayed.

The VCS integration should be correctly configured in the IDE and TeamCity should be able to match the files on the developer workstation to the build configurations present on TeamCity server. In order to be able to do that, VCS should be configured in the same way on the developer's workstation and on the server. This includes:

  • for CVS, TFS and Perforce version control systems - use exactly the same URLs to the version control server

  • for VSS - use exactly the same path to the VSS database (machine and path)

  • for Subversion - use the same server (TeamCity matches server UUID)

  • for Git - the current checked out branch should have "remote" set to the server/branch monitored by the TeamCity server and should have common commits in the history with the server-monitored branch.

If upon changed files choosing TeamCity is unable to find build configurations that the files can be sent to, option to initiate the personal build will not be available.

General Flow of a pre-tested commit

  • Developer uses Remote Run dialog of TeamCity IDE plugin to select files to be sent to TeamCity.

  • Based on the selected files a list of applicable build configurations is displayed. Developer selects the build configurations to test the change against and sets options for pre-tested commit.

  • TeamCity IDE plugin builds a "patch" - full content of all the files selected and sends it to the TeamCity server. The patch is also preserved locally on developer's machine. When sent, the change appears on developer's My Changes. Developer can continue working with the code and can modify the files sent to the pre-tested commit.

  • The personal build is queued and processed like other queued builds.

  • When build starts, it checks out the latest sources just like normal build and then applies developer's personal changes sent from IDE over (full file content is used)

  • The build runs as usual

  • At the end of the build the personal changes are reverted from the build's checkout directory to make sure they do not affect following builds

  • TeamCity IDE plugin pings TeamCity server to check if all the selected build configurations have personal builds ready. If a build fails, a notification is displayed in IDE. and the process ends.

  • If all the personal builds finish successfully, IDE plugin displays a progress, backs up the current version of the files participating in the personal change (as they might already be modified since pre-tested commit initiating), then restores the file contents from the saved "patch", performs the version control commit (reports an error if there was an error like VCS conflict) and restores the just backed up files to bring the working copy in the last seen state. A pre-tested commit in TeamCity plugin window gets an error or success mark.

Last modified: 20 April 2023