How to prevent saving project's configuration if there are configuration failures?

15 views
Skip to first unread message

Kirill

unread,
Mar 17, 2015, 11:48:01 AM3/17/15
to jenkin...@googlegroups.com
Hi folks,

I added few mandatory fields to my build step's config.jelly with the validation that ensures validation errors appearance if mandatory fields are empty.
Is there a way to prohibit saving the job if it's configuration contains validation errors?

Regards,
Kirill.

Ulli Hafner

unread,
Mar 17, 2015, 6:36:26 PM3/17/15
to jenkin...@googlegroups.com
I don’t think that this is possible.

--
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 jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/741882c1-dc50-4a21-9023-8e6621ba3383%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Baptiste Mathus

unread,
Mar 18, 2015, 12:55:23 AM3/18/15
to jenkin...@googlegroups.com

+1.

Btw, maybe this is something to add as input for the work going on on the UX and the way plugin UI is developed?

Christopher Orr

unread,
Mar 18, 2015, 1:25:15 AM3/18/15
to jenkin...@googlegroups.com
You can always create a job config programmatically, write config.xml
directly to disk, or upload config via the CLI.

So basically there's no way of preventing bad config from being entered
— plugins should make a reasonable effort at runtime to sanity check the
config.

-Chris


On 17/03/15 21:55, Baptiste Mathus wrote:
> +1.
>
> Btw, maybe this is something to add as input for the work going on on
> the UX and the way plugin UI is developed?
>
> Le 17 mars 2015 23:36, "Ulli Hafner" <ullrich...@gmail.com
> <mailto:ullrich...@gmail.com>> a écrit :
>
> I don’t think that this is possible.
>
>> Am 17.03.2015 um 16:48 schrieb Kirill <yam...@gmail.com
>> <mailto:yam...@gmail.com>>:

Ulli Hafner

unread,
Mar 18, 2015, 7:16:25 AM3/18/15
to jenkin...@googlegroups.com

> Am 18.03.2015 um 06:24 schrieb Christopher Orr <ch...@orr.me.uk>:
>
> You can always create a job config programmatically, write config.xml directly to disk, or upload config via the CLI.
>
> So basically there's no way of preventing bad config from being entered — plugins should make a reasonable effort at runtime to sanity check the config.

This is a different thing. A plug-in should always check the input data on the application layer.

But additionally, the UI layer should never allow the creation of invalid configurations. This is one of the main reasons that there is an UI layer.

>
> -Chris
>
>
> On 17/03/15 21:55, Baptiste Mathus wrote:
>> +1.
>>
>> Btw, maybe this is something to add as input for the work going on on
>> the UX and the way plugin UI is developed?
>>
>> Le 17 mars 2015 23:36, "Ulli Hafner" <ullrich...@gmail.com
>> <mailto:ullrich...@gmail.com>> a écrit :
>>
>> I don’t think that this is possible.
>>
>>> Am 17.03.2015 um 16:48 schrieb Kirill <yam...@gmail.com
>>> <mailto:yam...@gmail.com>>:
>>>
>>> Hi folks,
>>>
>>> I added few mandatory fields to my build step's config.jelly with
>>> the validation that ensures validation errors appearance if
>>> mandatory fields are empty.
>>> Is there a way to prohibit saving the job if it's configuration
>>> contains validation errors?
>>>
>>> Regards,
>>> Kirill.
>
> --
> 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 jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/55090C25.10807%40orr.me.uk.
signature.asc

Jesse Glick

unread,
Mar 18, 2015, 11:10:37 AM3/18/15
to Jenkins Dev
On Tue, Mar 17, 2015 at 6:36 PM, Ulli Hafner <ullrich...@gmail.com> wrote:
> I don’t think that this is possible.

Correct: https://issues.jenkins-ci.org/browse/JENKINS-19584

Kirill

unread,
Mar 19, 2015, 4:43:56 PM3/19/15
to jenkin...@googlegroups.com
Thanks a million! 100% clear now.

среда, 18 марта 2015 г., 17:10:37 UTC+2 пользователь Jesse Glick написал:

Kanstantsin Shautsou

unread,
Mar 28, 2015, 6:50:16 AM3/28/15
to jenkin...@googlegroups.com
Wouldn't throw new FormException() from constructor/setter work to not accept Describeable re-recreation?
Reply all
Reply to author
Forward
0 new messages