Perforce
Last modified: 20 April 2023This page contains descriptions of the fields and options available when setting up VCS roots using Perforce. Common VCS Root properties are described here.
note
A Perforce client must be installed on the TeamCity server. Check TeamCity and Perforce compatibility.
If you plan to use the agent-side checkout mode, note that a Perforce client must be installed on the agents, and the path to the p4 executable must be added to the PATH environment variable.
P4 Connection Settings
Option | Description |
---|---|
Specify the Perforce server address. The format is | |
Click this radio button to specify an existing Perforce stream. TeamCity will use this stream to prepare the stream-based workspace, and will use the client mapping from such a workspace. The format should be
| |
Click this radio button to directly specify the client workspace name. The workspace must be already created by a Perforce client application like P4V or P4Win. Only the mapping rules from the configured client workspace are used. The client name is ignored.
| |
Click this radio button to specify the mapping of the depot to the client computer. If you have Client mapping selected, TeamCity handles file separators according to the OS/platform of the build agent where a build is run. To enforce specific line separator for all build agents, use Client or Stream having
Example:
Editing the client mapping for a Perforce VCS root will result in a clean checkout before the next build. See the available workaround. | |
Specify the user login name. | |
Specify the password. | |
Check this option to enable ticket-based authentication. |
Checkout On Agent Settings
When the agent-side checkout is used, TeamCity creates a Perforce workspace for each checkout directory/VCS root. These workspaces are automatically created when necessary and are automatically deleted after some idle time. It is possible to customize the name generated by TeamCity: add the teamcity.perforce.workspace.prefix
configuration parameter at the Configuring Build Parameters page with the prefix in the value.
Option | Description |
---|---|
If needed, you can set here the following options for the http://www.perforce.com/perforce/doc.092/manuals/cmdref/client.html#1040665 command: | |
Run 'p4 clean' for cleanup | Enable this option to clean up your workspace from extra files before a build (since p4 2014.1) When enabled, the |
Don't update server on sync | Enable this option to use clean checkout and skip updating the Perforce db.have file (http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_sync.html) |
Extra sync options | Specify additional 'p4 sync' options, like |
Perforce Workspace Parameters
With checkout on agent, TeamCity provides environment variables describing the Perforce workspace created during the checkout process. If several Perforce VCS Roots are used for the checkout, the variables are created for the first VCS root. The variables are:
P4USER - same as
vcsroot.<VCS root ID>.user
parameterP4PORT - same as
vcsroot.<VCS root ID>.port
parameterP4CLIENT - name of the generated P4 workspace on the agent
These variables can be used to perform custom p4 commands after the checkout.
Perforce Proxy Settings
To allow using Perforce proxy with the agent-side checkout, specify the env.TEAMCITY_P4PORT
environment variable on the build agent and the agent will take this value as the P4PORT
value.
Other Settings
Specify the path to the Perforce command-line client: | |
---|---|
If you need to check out sources not with the latest revision, but with a specific Perforce label (with selective changes), you can specify this label here. For instance, this can be useful to produce a milestone/release build, or a reproduce build. If the field is left blank, the latest sources revision will be used for checkout. You can also specify a changelist number here.
| |
Select the character set used on the client computer. | |
Support UTF-16 encoding | Enable this option if you have UTF-16 files in your project. |