Perforce trigger script not found

34 Views Asked by At

I have a python script trigger.py stored in a depot at //MyDepot/TriggerTest-main/trigger.py. I want this to trigger whenever a user attempts to submit a changelist in //MyOtherDepot.

My trigger spec is as follows:

Triggers:
    block-all-changes change-submit //MyOtherDepot/... "py %//MyDepot/TriggerTest-main/trigger.py%"

I get the following error when I make a submit request from //MyDepot:

    Submit validation failed -- fix problems then use 'p4 submit -c 104762'.
    'block-all-changes' validation failed: 
    Execution Failed: py /tmp/tmp.8904.140611025375744.260.py: No such file or directory
    Submit aborted -- fix problems then use 'p4 submit -c 104762'.

Why is the script not being located?

2

There are 2 best solutions below

2
J Brown On BEST ANSWER

I'm thinking py isn't in the PATH.

Hard code your path to rule that out:

block-all-changes change-submit //MyOtherDepot/... "/usr/bin/py %//MyDepot/TriggerTest-main/trigger.py%"
1
Jase On

Helix core trigger scripts need to be placed directly on the Helix core machine, not inside of a Depot path.

So if you instead put that file into a local path on the server, like /p4/triggers/trigger.py (I'm assuming a Linux server, so this path would be different on Windows) then update your p4 triggers table to

Triggers:
    block-all-changes change-submit //MyOtherDepot/... "python /p4/triggers/trigger.py %changelist%"

In this example, I have it passing the %changelist% argument as an example, even though you hadn't included that in yours.

This should be equivalent to running (using your changelist from above).

py /p4/triggers/trigger.py 104762

To test it, you can try running that command directly on the server to see if it works.