P41.7.4Minimum Jenkins requirement: 1.642.3ID: p4
P4 Plugin - By Perforce Software. Jenkins plugin for a Perforce Helix Versioning Engine.
Please consider helping out and joining this project to make it even better.
There are many features to add and a growing backlog of SIRs, I am happy to accept GitHub pull requests or Shelved Swarm reviews. Any questions please contact me via our support team firstname.lastname@example.org.
P4 Plugin for Jenkins manages Perforce Helix workspaces; synchronising code and polling/triggering builds.
The P4 Plugin has been fully tested against Helix P4D release version 2015.1
The plugin supports:
- Credential authentication
- Client Workspace management
- Synchronisation behaviour
- Polling and filtered builds
- External review tools (Swarm)
- Change-list browsing
- Labeling builds (Tagging)
- External repository browsers (P4Web, Swarm)
- Submit assets back to Perforce Helix (Publish)
- Jenkins 1.642.3 or greater.
- Helix Versioning Engine 2012.1 or greater.
- Minimum 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.
All issues are managed on the JIRA Agile Board, when reporting an issue please set the Component to `P4` (not `Perforce`).
- Some parameters are not available during Polling. As a result these variables will not get expanded leading to unexpected results (e.g. new workspaces being created resulting in continuous polling). Jenkins job and multi configuration parameters should be expand, but custom or parameterised build variables are unlikely to be available.
The plugin makes use of the Jenkins Credential store making it easier to manage the Perforce Helix Server connection for multiple Jenkins jobs. P4 Plugin credentials must be added to the Global or a user defined domain, using one of the two supported Credentials: 'Perforce Password Credential' or 'Perforce Ticket Credential'.
To add a 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 a Secured Helix Versioning Engine; to use just check the SSL box and provide the Trust fingerprint.
Client Workspaces are configured on the Jenkins Job configuration page and support the following behaviours:
The workspace specified must have been previously defined. The P4 Plugin 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.
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.
The P4 Plugin will populate the Jenkins 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
The P4 Plugin 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 The P4 Plugin will then clean up any extra files or restore any modified or missing files. Finally, the P4 Plugin will sync the required file revisions to the workspace populating the 'have' table.
- Forced clean and sync
The P4 Plugin 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
The P4 Plugin 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.