Perforce
This page contains descriptions of the fields and options available when setting up VCS roots using Perforce.
Common VCS root properties are described here.
P4 Connection Settings
Option | Description |
---|---|
Port | Specify the Perforce server address. The format is |
Stream | 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. TeamCity supports deeper directory structure within the root depot: depots with a depth of Parameters are supported. For the Enable feature branches support (experimental) — select this checkbox to specify branch streams you want to be monitored for changes in addition to the default one. Enter / Edit the branch specification as a newline-delimited set of rules. The syntax is |
Client | Click this radiobutton 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. |
Client Mapping | Click this radiobutton 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 with the Example: //depot/MPS/... //team-city-agent/...
//depot/MPS/lib/tools/... //team-city-agent/tools/...
Clean Checkout on a client mapping change is not enforced for the agent-side checkout in the following cases:
If the direct client mapping is changed, a clean checkout will be forced unless the |
Username | Specify the user login name. |
Password or Ticket | Specify the password or ticket. If this field is specified, TeamCity
If the password is not specified at all, TeamCity relies on an existing p4 ticket for the current user ( The ticket file, should be present on all build agents where TeamCity runs perforce builds for this VCS root and on the TeamCity server (as the server also executes perforce commands). |
Ticket-based authentication | Check this option to enable ticket-based authentication. This option is enabled by default and not displayed. |
Case-Insensitivity in Checkout Rules
Note that Perforce support in TeamCity treats checkout rules as case-sensitive. Case-insensitivity for Perforce-based build configurations can be enabled on the Version Control Settings page by adding the following comment in the Edit Checkout Rules form: ##teamcity ignore-case
.
Agent Checkout 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 Parameters page with the prefix in the value.
Option | Description |
---|---|
Workspace options | If needed, you can set here the following options for the p4 client command: |
Create non-stream workspace | This option is available only when ' Stream' is selected in Connection Settings. Enable the option to be able to check out using a non-stream workspace based on the stream specification. This allows using checkout rules but makes it impossible to commit to the stream within the build. |
Run 'p4 clean' for clean-up | Enable this option to clean up your workspace from extra files before a build (since p4 2014.1). When enabled, the |
Skip the have list update | Enable this option not to track files on the Perforce server on sync (always transfer all files to the agent, p4 sync -p ). |
Extra sync options | Specify additional |
Perforce Workspace Parameters
With checkout on an 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.
More information: Perforce Workspace Handling in TeamCity
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
P4 path on the build agent | Specify the path to the Perforce command-line client: This field works only on the agent side for agent-side checkout. On the agent side, the value of this parameter could be overridden via For the server, the p4 binary should be present in the PATH of the TeamCity server or can be specified via the To restore old behavior, the |
Label/changelist to sync | 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. If the field is left blank, the latest changelist will be used for sync. |
Charset | Select the character set used on the client computer. |
Support UTF-16 encoding | Enable this option if you have UTF-16 files stored as You may want to enable this option if you use server-side checkout and have files of the If you store |
Perforce Jobs Support
For a changelist which was checked in with one or several associated jobs, TeamCity shows a wrench icon which allows you to view details of the jobs when clicked or hovered over.
Logging
All Perforce plugin operations are logged into teamcity-vcs.log
files with category jetbrains.buildServer.VCS.P4
(on an agent or on a server, depending on the operation context). The detailed logging can be enabled with TeamCity Server Logs.
Perforce Workspace Handling in TeamCity
Refer to a separate page.
Perforce VCS Compatibility
Refer to a separate page.
Perforce Streams as feature branches
Refer to a separate page.