Helix Plugin for Jenkins Guide (1.11.x)

cleanup Perforce: Cleanup

Used to cleanup the client workspace after the build. Optionally, setting the global option will delete the workspace files.


To delete the workspace files after the build, use the global setting in Perforce: OnDelete Workspace Options, see Perforce: OnDelete Workspace Options.

Example cleanup Perforce: Cleanup configuration

Image of xample cleanup Perforce: Cleanup

Example generated script for cleanup: Perforce: Cleanup

The form above generates the following script snippet:


Paste the script snippet into a basic script

Example: the script snippet above has been pasted into a basic script:

pipeline {
    agent any 
    stages {
        stage('Cleanup') {
			steps() {
				// cleanup workspace

Configure a cleanup Perforce: Cleanup script

  1. To create a Cleanup script, select cleanup Perforce: Cleanup from the Sample Step dropdown
  2. Delete Client checkbox:

Generate Pipeline Script

To generate the pipeline script, click Generate Pipeline Script. The script is generated in the text box below the button.

Copy the generated script and paste it into the Script box on the Jenkins Pipeline Script page.

Perforce: OnDelete Workspace Options

Specify how cleanup is handled for a Jenkins job that includes a cleanup Perforce: Cleanup script.

From the Jenkins home page browse to Manage Jenkins > Configure System > Perforce: OnDelete Workspace Options:

You can select a number of options:

  • Delete Perforce client: only applicable when deleting a Jenkins job.
  • Delete Workspace files: if your Jenkins job contains a cleanup step or you are deleting a Jenkins job: Perforce deletes the workspace files including the have list.