[OpenStack-Infra] JJB optional parameters usefulness
Thanh Ha
thanh.ha at linuxfoundation.org
Thu Mar 10 16:21:05 UTC 2016
On 1 March 2016 at 10:08, David Caro <dcaro at redhat.com> wrote:
> On 02/17 16:52, Thanh Ha wrote:
> > On 16 February 2016 at 10:03, Darragh Bailey <daragh.bailey at gmail.com>
> > wrote:
> >
> > > Think it all comes down to the following:
> > > * Need to understand what exactly is happening within Jenkins with
> > > regard to XML updating, clearly not just taking the XML given and
> > > changing to match that, more likely some kind of merge is going on.
> > >
> >
> > Agreed. I'll try to reach out to the Jenkins team and see if I can get a
> > statement from them about how this is supposed to work.
> >
> >
> > > * Is the sort of workflow described by David limited to the disabled
> > > tag, or useful elsewhere? If limited I think we should handle
> > > 'disabled' as a special case.
> > >
> >
> > Agreed. I think we should handle it specially and making sure it's
> > documented. I do see it being useful for "disabled". David can you
> confirm
> > if there's other fields you believe needs to be handled specially like
> this
> > one?
>
>
> The description of the job too, both of them are the ones we use on our
> flow,
> as you can't actually add a comment to the disabled status.
Good to know. We'll make a note to treat both those fields specially.
> > * If the decision is to change behaviour going forward, initially
> > > needs to only apply to new settings being added and have a way of
> > > converting existing code while matching existing behaviour via some
> > > setting.
> > >
> > > Expect we'll have to support existing use of optionals for at least
> > > one major release for the current modules whether we decide to switch
> > > the behaviour for the future or not. So the change identified will
> > > have to keep that in consideration.
> > >
> >
> > I'm not sure how much the impact is but unless you ever purposely set an
> > optional setting to something previously, the optional parameter in
> Jenkins
> > is the default setting already just not explicitly. I've only ever been
> hit
> > with this issue when I set something on purpose and decide later that I
> no
> > longer want it and delete the setting, expecting it to revert to the
> > default.
> >
> > I'm not sure how best to handle this as it is a behaviour change and
> would
> > be difficult to support 2 behaviours at the same time as it's hard to
> tell
> > which one should be used. One thought is if we're going with the
> > discussions from patch https://review.openstack.org/261620/
> >
> > 1. Put a single warning when JJB completes running that states something
> > like:
> >
> > ATTENTION: The behaviour of parameters marked as (optional) is
> > changing. In future releases if not passed they will revert to a default
> > setting.
> >
> > 2. We can add the "fail_required=False" parameter to the
> convert_mapping_to_xml
> > function as suggested
> >
> > This leaves existing functionality for plugins that use the
> > convert_mapping_to_xml function at least to stay the same and for all new
> > plugins set "fail_required=True", after a few releases we can flip the
> > switch so that it's True by default.
> >
> > 3. We start converting plugins using convert_mapping_to_xml function with
> > the fail_required=True setting and set correct "defaults" for optional
> > settings
>
> This would mean that the jenkins plugins defaults would be overriden by
> whatever jjb thinks is the default no? Would require to keep track of those
> default values on the jjb side to match the versions of the plugins?
>
Yes, however most of the plugins do this today already anyway so there's no
change in behaviour except for the percentage of those that allow optional
fields which I've found to be a much smaller percentage. In fact in some
cases the docs incorrectly state that a field is optional yet the code does
a data.get(value, default) indicating that it's actually setting a default.
We'd depend on the plugin writers to set the defaults to be the same as the
Jenkins plugins. This is what's already happening today so I see no
difference here. We now have a convert_mapping_to_xml() function which
significantly simplifies code related to jenkins plugins so should make it
much easier and less intimidating for someone to fix the defaults if they
find it incorrect. You can see an example here:
https://github.com/openstack-infra/jenkins-job-builder/blob/master/jenkins_jobs/modules/builders.py#L2485
As I mentioned before I have an intern coming on this summer who I plan to
task with converting our code base to using this function when defining
plugin support.
Regards,
Thanh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-infra/attachments/20160310/a1fb5495/attachment.html>
More information about the OpenStack-Infra
mailing list