Need an option to add '-f' to 'p4 client -d' but make it clear that the option requires the Perforce user to have 'admin' level access. This is to allow clients with empty pending changelists to be deleted.
From doc:
$ p4 help client ...cut... The -d flag deletes the specified spec, as long as the client workspace has no opened files or pending changes. (See 'p4 help opened'.) The -f flag forces the delete. ...cut... The -f flag can force the updating of locked clients; normally locked clients can only be modified by their owner. -f also allows the last modified date to be set. The -f flag requires 'admin' access granted by 'p4 protect'.
Reproduction Steps:
- On Manage Jenkins > Configure System tick 'Delete Perforce client'.
- Create a freestyle job that syncs files.
- Create an 'execute Shell' build step that creates a changelist.
p4 -u $P4_USER -c $P4_CLIENT -p $P4_PORT --field Description=New_CL change -o | p4 -u $P4_USER -c $P4_CLIENT -p $P4_PORT change -i
- Select the Post-build Action 'Delete Client' and tick 'Delete Client'
- Run job.
- Client not deleted and error seen:
P4 Task: remove client: jenkins-built-in-DeleteWorkspaceFreestyle-2
... p4 client -d jenkins-built-in-DeleteWorkspaceFreestyle-2 -p4 client -d jenkins-built-in-DeleteWorkspaceFreestyle-2
Client 'jenkins-built-in-DeleteWorkspaceFreestyle-2' has pending changes. To delete the client, delete any pending changes first. An administrator may specify -f to force the delete of another user's client.
Finished: SUCCESS