TeamCity On-Premises 2026.1 Help

Perforce Shelve Trigger

The Perforce shelve trigger automatically runs a build on detecting a change in shelved files of your Perforce changelists.

Prerequisites

The trigger supports Perforce 2018.2 or later.

Trigger Settings

The trigger monitors all Perforce VCS roots associated with the current build configuration. You can filter monitored changelists by their description. To do this, specify the required keyword to search.

Trigger Behavior

On any change made in shelved files of a matching changelist, TeamCity will start a new personal build with the contents of these files.

If the current build is composite, the whole build chain will be triggered on a change in shelved files.

If stream support is enabled in the Perforce VCS root settings, this trigger will detect the target stream from the changed files and run the personal build in this stream even if the default stream is specified.

TeamCity processes shelved files as follows:

  1. Remote sources are checked out (on the agent side, see the note below).

  2. The p4 unshelve -s <specified-changelist> command is called.

  3. p4 sync runs again to restore the latest revisions of any files affected by the unshelve step.

  4. p4 resolve -am automatically merges changes and resolves conflicts. If any conflicts remain unresolved, the build fails.

  5. The personal build starts.

  6. After the build completes, the p4 revert and p4 clean restore the workspace to its original state and remove files introduced from the shelf.

Parametrized Shelved Changelist ID

TeamCity provides a configuration parameter vcsRoot.rootExternalId.shelvedChangelist with the ID of the changelist whose changes triggered this build.

If the VCS Root ID is unavailable/unnecessary, use the vcsRoot.1.shelvedChangelist configuration parameter.

Logging Events

This trigger logs events to the teamcity-triggers.log file with the perforceShelveTrigger logging key.

23 March 2026