We have started adding the following to all jobs:
p4 login -s
IF ERRORLEVEL 1 EXIT %ERRORLEVEL%
We have tickets setup on all Jenkins and would expect this to NEVER fail . . . but of course it does on occasion because somebody does something to cause a logout.
The reason I've posted here, is that even putting this at the start of every job is not enough . . . We really want this done BEFORE all the stuff your plugin does to get the job started . . . and in fact, it would be nice if polling itself could do something similar . . . though in that case where do you report the error?
It would be nice to be able to check as "user should already be logged in" check box and have you add a bunch of checking for this . . . the error messages we get now are often obscure and don't immediately lead the uninitiated to the conclusion that the automation username need to be logged in again.
IN FACT . . . I'm way out there now, but just a thought . . . one of the annoying things about this happening is that when a single slave has a problem like this, a whole bunch of work will "abort into that slave" . . . it would be nice if when a username isn't logged in, you could affect the scheduling too so that host wasn't used until the username is logged back in or perhaps disable the slave until somebody can bring Perforce on-line again.
Voted and Watched
Un-assigning this from digerata per request by him.