Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 for Jenkins Documentation | 1.17.3

# 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

### Example generated script for cleanup: Perforce: Cleanup

The form above generates the following script snippet:

    cleanup(
        false
    )

### 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
    				cleanup(
    					false
    				)
    			}
            }
        }
    }

## 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:

- Selected:Perforce cleans up the client workspace including the have list. Optionally, setting the global option will delete the workspace files, see Perforce: OnDelete Workspace Options.
- Unselected: the client workspace is not deleted. Optionally, setting the global option will delete the workspace files, see Perforce: OnDelete Workspace Options.

### 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 > System Configuration > System then scroll down to the section called 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.

Your search for returned results