Hi,

I'm trying to make validating-string-parameter-plugin [1] work with
Jenkins Pipelines.

So far I've managed to get it "working" by throwing a raw
RuntimeException from the @Override buildEnvironment [2]. But this is
far from optimal, as AFAIU buildEnvironment shouldn't be dealing with
parameters valitation at all. The problem with the current version of
the plugin instead is that runtime validation is performed by setUp
method of BuildWrapper(), which doesn't get invoked when using
Pipelines.

So, ideally I would actually like to prevent user hitting "Build" button
if form validation wasn't OK. Is there a way to perform realtime
validation (validation is currently performed when the field looses
focus) and grey out "Build" button if validation didn't succeed?

Alternatively, I was thinking that ParameterDefinition:createValue()
might be changed to possibly throw some form of exception
(AbortException maybe?) if something was wrong at the time user hit
"Build". Of course this would require Jenkins' core mods, would that be
a reasonable and acceptable approach?

Thanks in advance for your help!

Best,

- Juri

[1] https://github.com/jenkinsci/validating-string-parameter-plugin
[2] 
https://github.com/jlelli/validating-string-parameter-plugin/commit/c76ec48b645fb5315c064bf23553e708f671c530#diff-7f2cc2852df243adfa24654a14dc3d5cR94
[3] 
https://github.com/jenkinsci/validating-string-parameter-plugin/blob/master/src/main/java/hudson/plugins/validating_string_parameter/ValidatingStringParameterValue.java#L73

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/20180326172052.GA25184%40localhost.localdomain.
For more options, visit https://groups.google.com/d/optout.

Reply via email to