Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »


P4 Plugin - By Perforce. Jenkins plugin for Perforce 

Plugin Information

View P4 on the plugin site for more information.


P4 Plugin for Jenkins manages Perforce workspaces; synchronising code and polling/triggering builds. The plugin supports:

  • Perforce authentication
  • Perforce workspace management
  • Synchronisation behaviour
  • Polling and filtered builds
  • External review tools (Swarm)
  • Change-list browsing
  • Labeling builds (tagging)
  • External repository browsers (P4Web, Swarm)


  • Jenkins 1.509 or greater.
  • Perforce Server 2012.1 or greater.
  • Minimum Perforce Protection of 'open' for the Jenkins user.
  • If you wish to use the Review Build feature you will need Swarm. 
  • Swarm 2014.2 or greater is required to support Jenkins authentication.


The plugin makes use of the Jenkins Credential store making it easier to manage the Perforce Server connection for multiple Jenkins jobs.  Perforce Server credentials must be added to the Global or a user defined domain, using one of the two supported Perforce Credentials: 'Perforce Password Credential' or 'Perforce Ticket Credential'.

To add a Perforce Credential:
1. Navigate to the Jenkins Credentials page (select 'Credentials' on the left hand side)
2. Select 'Global credentials' (or add domain if needed)
3. Select 'Add Credentials' from the left hand side
4. Choose 'Perforce Password Credential' from the 'Kind' drop-down select
5. Enter a Description e.g. local test server
6. Enter the P4Port e.g. localhost:1666
7. Enter a valid username and password
8. Press the 'Test Connection' button (you should see Success)
9. Click 'Save' to save.

The Perforce Ticket Credential supports using a ticket file (such as the default P4TICKETS file) or a ticket value (returned by the command p4 login -p). If Ticket authentication is used for remote builds the Ticket must be valid for the remote host (either login on the remote host or use p4 login -a).

All Perforce Credential types support SSL for use on Secured Perforce Servers; to use just check the SSL box and provide the Trust fingerprint.


Perforce workspaces are configured on the Jenkins Job configuration page and support the following behaviours:

  • Static
    The workspace specified must have been previously defined.  The Perforce Jenkins user must either own the workspace or the spec should be unlocked allowing it to make edits.  The workspace View remains static, but Jenkins will update other fields such as the workspace root and clobber option.
  • Spec File
    The workspace configuration is loaded from a depot file containing a Client workspace Spec (same output as p4 client -o and the Spec depot '.p4s' format). The name of the workspace must match the name of the Client workspace Spec.
  • Manual
    This allows the specified workspace to be created (if it does not exist) or update the spec by setting the various options.  Jenkins will fill out the workspace root and may override the clobber option.
  • Template & Stream
    In this mode the workspace View is generated using the specified template workspace or stream.  The name of the workspace is generated using the Workspace Name Format field and makes it an ideal choice for matrix builds.


Perforce will populate the workspace with the file revisions needed for the build, the way the workspace is populated is configured on the Jenkins Job configuration page and support the following behaviours:

  • Automatic cleanup and sync
    Perforce will revert any shelved or pending files from the workspace; this includes the removal of files that were added by the shelved or pending change. Depending on the two check options boxes Perforce will then clean up any extra files or restore any modified or missing files. Finally, Perforce will sync the required file revisions to the workspace populating the 'have' table.
  • Forced clean and sync
    Perforce will remove all files from under the workspace root, then force sync the required file revisions to the workspace.  If the populating the 'have' table options is enabled then the 'have' list will be updated.

This method is not recommended as the cost of IO resources on server and client are high. Apart from exceptional circumstances the Automatic cleanup and sync option will produce the same result.

  • Sync only
    Perforce will not attempt to cleanup the workspace; the sync operation will update all files (as CLOBBER is set) to the required set of revisions.  If the populating the 'have' table options is enabled then the 'have' list will be updated.


Please refer to the README for more information.


type key summary assignee reporter priority status resolution created updated due

The URL filter is not available to you, perhaps it has been deleted or had its permissions changed

View these issues in Jira
  • No labels