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:
Remote sources are checked out (on the agent side, see the note below).
The
p4 unshelve -s <specified-changelist>command is called.p4 syncruns again to restore the latest revisions of any files affected by theunshelvestep.p4 resolve -amautomatically merges changes and resolves conflicts. If any conflicts remain unresolved, the build fails.The personal build starts.
After the build completes, the
p4 revertandp4 cleanrestore 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.