jenkinsci/perforce-plugin — pull request #29 by oleg-nenashev (2013-06-14 09:50:44+00:00)
Title: Validation of parameter substitution results

Dears p4 plugin maintainers ,

I’ve added function layer, which performs validation of parameter substitution results. It resolves [JENKINS-18346][1] and probably many other bugs with improper behavior of perforce plugin.
Changes summary:
* Added verification level and moved existing substituteParameters to another class.
* Refactored PerforceSCM methods. Therefore, all methods use verification of the parameters after substitution. For example, P4 blocks workspace cleanup if it is not possible to resolve parameter.
* Check of P4CONFIG global variable existence and appropriate setup of filters

At current state, verification function checks only “${VAR}” format, but not $VAR. I’m not sure about acceptable symbols in perforce configuration, but probably it would be useful to have such validation too.

I would be grateful if anyone answers the following questions:
* Does such approach acceptable for the main branch of plugin?
* Should we add “Enable substitution validation” switch or something like that in order to preserve legacy behavior (even it causes errors in some cases)?
* Is it possible to test proposed patch against Jenkins installation with many p4-based jobs (p4 plugin test host or something like that)? I suppose that patch can corrupt some typical use-cases (like it was with P4CONFIG)

Best regards,
Oleg Nenashev
R&D Engineer, Synopsys Inc.
[www.synopsys.com][2]

[1]: https://issues.jenkins-ci.org/browse/JENKINS-18346
[2]: http://www.synopsys.com/