Environment:RedHat EL 5.5
The perforce plugin does not always parse the session ticket from "p4 login -p" correctly, causing the job to fail.
I noticed this when using the coverity plugin in combination with the perforce plugin. The coverity plugin causes some extra text to be emitted from the "p4 login -p" command, which seems to confuse the parser in the perforce plugin.
Example of the extra text:
timm@daxtsmtf02> cov-build --dir foo p4 login -p
[WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.
Please make sure you have configured the compilers actually used in the compilation.
For more details, please look at:
When this happens in Jenkins, it looks like the perforce plugin is just taking the last line of output (instead of the second line) as the session ticket. Example from Jenkins console log:
[workspace] $ cov-build --dir /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp p4 workspace -o MTFRA_ME_static_analysis
[workspace] $ cov-build --dir /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp p4 login -p
[workspace] $ cov-build --dir /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp p4 -P " /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp/build-log.txt" workspace -o MTFRA_ME_static_analysis
Caught exception communicating with perforce. Perforce password (P4PASSWD) invalid or unset.com.tek42.perforce.PerforceException: Perforce password (P4PASSWD) invalid or unset.
I managed to workaround this problem by adding an option the coverity plugin which suppress the output of the extra text. But it is not ideal as the extra text is actually a warning message which might be useful at other stages in the build, and I have to suppress it for all stages.
Note: there is a related ticket open against the coverity plugin (
JENKINS-14834) which says the coverity plugin should not be active during the pre-build steps. If that was fixed, it would resolve this issue. But I opened this ticket for the perforce plugin as I think an improvement in the way the perforce plugin gets the session ticket would be a good change to make.