Re: [configuration-as-code] Descriptors configuration

2017-11-27 Thread nicolas de loof
Thanks ! 2017-11-27 23:53 GMT+01:00 Jesse Glick : > On Fri, Nov 24, 2017 at 8:17 AM, nicolas de loof > wrote: > > I'm looking if stapler can > > easily answer "does this descriptor have a global view" without making > > assumption on the view

Re: [configuration-as-code] Descriptors configuration

2017-11-27 Thread Jesse Glick
On Fri, Nov 24, 2017 at 8:17 AM, nicolas de loof wrote: > I'm looking if stapler can > easily answer "does this descriptor have a global view" without making > assumption on the view template language Try `Descriptor.getGlobalConfigPage`. -- You received this message

Re: [configuration-as-code] Descriptors configuration

2017-11-24 Thread nicolas de loof
Yes this is a good short terms workaround. I'm looking if stapler can easily answer "does this descriptor have a global view" without making assumption on the view template language, but I think your fix is ok for now, please push it to main repository 2017-11-24 14:07 GMT+01:00 Ewelina Wilkosz

Re: [configuration-as-code] Descriptors configuration

2017-11-24 Thread Ewelina Wilkosz
when I changed URL global = ConfigurationAsCode.class.getClassLoader().getResource(cl+"/global.jelly"); to URL global = descriptor.getKlass().toJavaClass().getClassLoader().getResource(cl+"/global.jelly"); it started working for me... On Friday, November 24, 2017 at 1:54:10 PM UTC+1, nicolas

Re: [configuration-as-code] Descriptors configuration

2017-11-24 Thread nicolas de loof
You're right, that was a distinct (non blocking) issue. this global.jelly lookup was working for me as I had mailer plugin declared as a dependency and ran mvn hpi:run for testing, so this lib is in core classpath will need to investigate a better way to check a Descriptor has a global.jelly view

Re: [configuration-as-code] Descriptors configuration

2017-11-24 Thread Ewelina Wilkosz
It looks the list is not empty, it's URL global = ConfigurationAsCode.class .getClassLoader().getResource(cl+"/global.jelly"); that returns null, is it the same issue you're talking about? On Friday, November 24, 2017 at 10:19:19 AM UTC+1, nicolas de loof wrote: > > yes indeed, for a reason I

Re: [configuration-as-code] Descriptors configuration

2017-11-24 Thread nicolas de loof
yes indeed, for a reason I don't understand yet, "Jenkins.getInstance().getExtensionList(Descriptor.class)" returns an empty list :-\ investigating ... 2017-11-24 9:51 GMT+01:00 Ewelina Wilkosz : > Hi Nicolas, I have a problem with configuring mailer > - if I use "mailer:"

Re: [configuration-as-code] Descriptors configuration

2017-11-24 Thread Ewelina Wilkosz
Hi Nicolas, I have a problem with configuring mailer - if I use "mailer:" as root element Jenkins won't start - exact copy from demo folder - if I put mailer under "jenkins:" root element there is no error on startup but no configuration is applied Is there anything special about that one, that

Re: [configuration-as-code] Descriptors configuration

2017-11-23 Thread nicolas de loof
I wrote this documentation for plugin developers to understand the required changes so we can support Descriptor as configuration-as-code targets. I'll work on writing some pull-requests applying this approach to

Re: [configuration-as-code] Descriptors configuration

2017-11-15 Thread nicolas de loof
this is really work in progress, i.e not even tested on my own before I propose this in a PR :P was just for information that I was looking into implementing a fix for this idea 2017-11-15 16:24 GMT+01:00 Jesse Glick : > On Wed, Nov 15, 2017 at 9:51 AM, nicolas de loof >

Re: [configuration-as-code] Descriptors configuration

2017-11-15 Thread Jesse Glick
On Wed, Nov 15, 2017 at 9:51 AM, nicolas de loof wrote: > proposed improvement to Descriptor.configure (WiP) : > https://github.com/ndeloof/jenkins/tree/JENKINS-48018 If you are soliciting feedback, just file as a PR and mark as `work-in-progress`. Easier to gather

Re: [configuration-as-code] Descriptors configuration

2017-11-15 Thread nicolas de loof
proposed improvement to Descriptor.configure (WiP) : https://github.com/ndeloof/jenkins/tree/JENKINS-48018 *tl;dr: * provide default implementation to Descriptor#configure using databinding. reset descriptor to default values based on properties types default *or* convention to declare a public

Re: [configuration-as-code] Descriptors configuration

2017-11-15 Thread Jesse Glick
On Tue, Nov 14, 2017 at 10:19 PM, Kohsuke Kawaguchi wrote: > I suppose we could create a variant of req.bindJSON(this,json) that does set > null on proeprties that are not specified in JSON. Yes, that would be a helpful convenience API, and it would make sense to call it in a

Re: [configuration-as-code] Descriptors configuration

2017-11-14 Thread Kohsuke Kawaguchi
On Fri, Nov 10, 2017 at 5:54 PM nicolas de loof wrote: > Right, so hopefully we already have docs on best practices for plugin > developers ;) > > An issue remain. Let's consider I refactor Mailer plugin to adopt this > approach (see >

Re: [configuration-as-code] Descriptors configuration

2017-11-13 Thread nicolas de loof
This is a comparable issue indeed, even this applies to updateByXml. not configure(json) https://github.com/jenkinsci/jenkins/pull/2736 is a promising approach, but is discovering attributes via reflection, while configuration-as-code is looking at ui-bound parameters. In many case they are the

Re: [configuration-as-code] Descriptors configuration

2017-11-13 Thread Daniel Beck
> On 13. Nov 2017, at 20:26, Jesse Glick wrote: > >> >> if I UNCHECK the optional property, no "authentication" value >> is posted to JSON form, and I don't get SMTPAuthentication reset to null in >> my descriptor. > > Unfortunately your `configure` override must start

Re: [configuration-as-code] Descriptors configuration

2017-11-13 Thread Jesse Glick
On Fri, Nov 10, 2017 at 3:54 AM, nicolas de loof wrote: > I'll rewrite configure method as : > > public boolean configure(StaplerRequest req, JSONObject json) throws > FormException { > req.bindJSON(this, json); > save(); > return true; > } > > (by the way,

Re: [configuration-as-code] Descriptors configuration

2017-11-10 Thread nicolas de loof
Right, so hopefully we already have docs on best practices for plugin developers ;) An issue remain. Let's consider I refactor Mailer plugin to adopt this approach (see https://github.com/ndeloof/mailer-plugin/commit/ffc57e0ff1cb1b74dc1d6fdcb2329a5b9141daaa), with a new nested optionalProperty

Re: [configuration-as-code] Descriptors configuration

2017-11-09 Thread Jesse Glick
On Thu, Nov 9, 2017 at 9:45 AM, nicolas de loof wrote: > As a sample for this > discussion let's consider Mailer plugin build step And the comment > this code is brain dead :-) > Until you have some clever hack to suggest, it looks to me we will need to > provide

[configuration-as-code] Descriptors configuration

2017-11-09 Thread nicolas de loof
This message is a follow up for discussion on https://github.com/jenkinsci/jep/pull/31#discussion_r149598856 configuration-as-code prototype include generic mechanism to configure arbitrary jenkins component relying on @DataBound* ui-binding