[p4] Trigger User issue

Ruy Diaz ruy at mezine.com
Fri Feb 9 14:27:45 PST 2007


Hi everyone,

 

I am having some trouble getting triggers to work properly on my Windows
2000 Server box running Perforce 2006.2.

 

I'm having trouble setting up a trigger that will fail a submit when no jobs
are appended. I have 

followed the examples in the documentation but I am still unable to get it
to work. I currently think It has something to do with user permissions or
something of the sort.

 

My setup is as follows:  

 

Security level: 1

 

Triggers:

 

       MustHaveJob change-submit //depot/...
"c:\PerforceScripts\enforcejob.cmd %changelist%"

 

Protections:

 

       write group developers * //...

       super user Administrator * //...

 

And my trigger script (enforcejob.cmd) is as follows:

 

@echo off

p4 describe -s %1 | findstr /c:"Jobs fixed"  nul

if errorlevel 1 echo You must provide a job

p4 describe -s %1 | findstr /c:"Jobs fixed"  nul

 

If I run the script directly on the server from the commandline (e.g.
enforcejob 26), it behaves correctly. However, when I try to submit a
changelist from p4v in my client with a user from the developers group, it
always fails showing the following regardless of wether I have attached a
job or not:

 

p4 submit -i

Submit validation failed -- fix problems then use 'p4 submit -c 28'.

'MustHaveJob' validation failed: You must provide a job

 

 I think the problem lies in what is being returned by 'p4 describe' to  the
perforce server because I tried changing the script to:

 

 p4 info

 p4 describe

 

And in the response, it looks like the describe is returning nothing  at all
(I removed echo off too):

 

p4 submit -i

Submit validation failed -- fix problems then use 'p4 submit -c 28'.

'MustHaveJob' validation failed: 

C:\Program Files\Perforce>p4 info

User name: SYSTEM

Client name: perforce1

Client host: perforce1

Client unknown.

Current directory: c:\Program Files\Perforce

Client address: 127.0.0.1:2771

Server address: perforce1:1666

Server root: C:\Program Files\Perforce

Server date: 2007/02/08 11:34:14 -0800 Pacific Standard Time

Server version: P4D/NTX86/2006.2/113956 (2007/01/04)

Server license: MeZine 10 users (expires 2007/03/15)

C:\Program Files\Perforce>p4 describe

 

I tried adding a SYSTEM user (as this is the user that p4 info shows when
called from within a trigger) and obtained the same result. I also tried
giving the SYSTEM 'super' privileges through 'p4 protect' to no avail. Is
there a way to change this current user?

 

I have tried providing a user and password with the p4 describe command and
this seems to work. However, I don't like the idea of having a password in
plaintext in the .bat file. Any workarounds? I have tried setting P4USER and
P4PASSWD using 'p4 set' but this also does not work, the SYSTEM user is
still used. I also tried executing 'p4 describe -u Administrator -s %1' with
no result.

 

 

Any pointers on what I'm doing wrong?

 

Thanks

Ruy

 



More information about the perforce-user mailing list