Wanda B.
Wanda B.

Reputation: 171

Perforce change-submit trigger to run script on client

I figured I'd post here, after posting on SuperUser, since I want to get input from software developers who might have encountered this scenario before!

I would like to initiate a series of validation steps on the client side on files opened within a changelist before allowing the changelist to be submitted.

For example, I wish to ensure that if a file is opened for add, edit, or remove as part of a changelist, that a particular related file will be treated appropriately based on a matrix of conditions for that corresponding file:

These validation steps must be initiated before the submit is accepted by the Perforce server. Furthermore, the validation must be performed on the client side since I must be able to reconcile offline work with the copies on clients' disks.

Environment:

Investigative Avenues Already Covered

I would love to use a change-submit trigger on the Perforce server to initiate a script/bundled executable on the client's computer to perform p4 operations on their workspace to complete the validation steps. However, references that I've found (albeit from years ago) indicate that this is not possible:

Thank you for reading and in advance for your help!

Upvotes: 4

Views: 1638

Answers (1)

Samwise
Samwise

Reputation: 71454

running any script on the client's computer and in particular operating on their local workspace would require credentials that most likely will not be made available.

This is the crux of it -- the Perforce server is not allowed to send the client arbitrary code to execute. If you want that type of functionality, you'd have to punch your own security hole in the client (and then come up with your own way of making sure it's not misused), and it sounds like you've already been down that road and decided it's not worth it.

Initial design was a strictly client-side custom tool, but this is not ideal since this would be a change of the flow that users are familiar with, and I would also have to implement a custom GUI.

My recommendation would be to start with that approach and then look for ways to decrease friction. For example, you could use a change-submit trigger to detect whether the user skipped the custom workflow (perhaps by having the custom tool put a token in the change description for the trigger to validate), and then give them an error message that puts them back on track, like "Please run Tools > Change Validator, or contact [email protected] for help"

Upvotes: 2

Related Questions