Friday, 2017-09-15

openstackgerritWayne Warren proposed openstack-infra/jenkins-job-builder master: Fix macro expansion in conditional step builder.  https://review.openstack.org/50377105:36
waynrwhoops, forgot to update that05:37
waynrthat solution is ugly as heck05:37
waynri'm also pretty sure there is at least one other place we need to worry about expanding build steps in a conditional thing05:38
waynrconditional publisher05:38
waynror something05:38
*** hashar has joined #openstack-jjb08:13
*** electrofelix has joined #openstack-jjb08:47
Odd_Blokewaynr: I don't really know what the motivation for the change was; is there a reason registry.dispatch has stopped doing macro expansion?13:29
Odd_Bloke(I'm wondering if a reference to either the parser or the macro registry could be passed to the module registry, to allow it to continue doing it?)13:29
Odd_Blokewaynr: An extremely rough thing that works: http://paste.ubuntu.com/25540520/13:30
Odd_Blokes/works/works for the trivial example I gave before/13:30
waynrthe motivation behind JJB 2.0 is to disentangle the object model of JJB in order to make it useful as something other than a command line tool, ie a library in a different command line tool's implementation13:55
Odd_BlokeRight.13:56
Odd_BlokeSo a reference to the parser is Right Out. :p13:56
waynrthe major JJB-as-a-library use case I had in mind when I began this work was to make the use of JJB YAML optional, or to be able to rewrite the yamlparser entirely while maintaining direct backwards compatibility with the use of config options13:57
waynryeah ;)13:57
Odd_BlokeGiving the ModuleRegistry an optional MacroRegistry might still be OK?13:58
waynrwell the ideal in my opinion is for the xml builder to be passed the fully macro-expanded and reified data structure at the time of xml building because it reduces the xml builder's dependency on details of how yaml parsing and macro expansion happen14:02
waynrbut then again the result as seen in my fix could be argued to be a kind of action-at-a-distance where plugin-specific behavior has leaked out of the module14:05
waynri suppose it's probably okay to give the module registry a reference to the macro registry since it would only ever be used in the case that there are macros left to expand at xml building time and if someone wanted to rewrite the yaml parser implementation all that would be necessary is to expand macros before getting to the xml building stage of the application14:07
*** hashar is now known as hasharAway14:44
Odd_BlokeYeah, the logic being so far away from the conditional step builder in your solution isn't great.14:44
Odd_Bloke(And doesn't lend itself to extensibility.)14:44
Odd_BlokeIf builders(/other things) could somehow say "anything at this YAML path in my configuration should be expanded as a (builder|...)", then it could remain in distinct passes.14:47
Odd_BlokeAnd then a parser reimplementation would just have to ensure it handled that correctly.14:47
waynrwell again, the ideal is that the xml builder doesn't care where the data from which it is building xml originates14:58
waynrbut i don't think including a macro registry reference in the module registry violates that principle15:00
Odd_BlokeIt seems like having two phases that each builder handles would help; the first phase transforms "raw" YAML to reified YAML, and the second transforms reified YAML to XML.15:44
Odd_BlokeThe problem is that in the XML generation phase, conditional_step has to reach back in to the parsing phase at the moment.15:45
waynrwell it doesn't have to actually15:47
waynrreaching back into the parser phase is only one way of accomplishing that goal15:48
waynrgiving the macro registry the ability to expand macros in places other than the standard top-level job components is another way (see my current fix)15:49
waynrJJB 2 (and not JJB 1.x) already conceptually divides transformation of raw yaml to reified yaml (we call it "parsing") from the transoformation of a recognizable data structure into xml15:55
waynrreaching back into the yaml parser from the xml generation modules breaks that divide15:55
waynrwell, "bridges" might be a better word15:55
waynrso i guess from the point of view of conceptually dividing yaml parsing/expansion from xml generation, reaching back into the yaml parser doesn't accomplish that goal...only implementation of macro expansion at different nesting points within the job data structure does15:57
waynr(taking back my comment at 15:48:13 UTC)15:58
Odd_BlokeRight, your implementation does avoid the reaching-back.16:23
Odd_Bloke(Though I think jj.modules.builders.create_builders is still reaching back, really.)16:24
*** electrofelix has quit IRC17:05
*** hasharAway has quit IRC17:35
*** hashar has joined #openstack-jjb17:35
*** hashar has quit IRC22:10

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!