Closed patrikcerbak closed 8 months ago
It sounds very correct. Thank you. Only it is quite compelx. But understandable . Few ideas to make it simplier: to read config from jenkins. To ahve soem defautl swithces in some config(s!). Maybe both.
Maybe it would be better to call the switch --build-config-find
and be explicit in docmumentation that it searches in build's top level directory, in archives. Maybe there will be need of simialr switch, but for --job-config-find
, which will search in the job's top level directory. That seesm to be overlaping with yout future PR about the proeprty based queryes.
There are now two arguments instead of just --config-find
:
--build-config-find
for searching a config file in build directory
--job-config-find
for searching a config file in job directory
Actually.. are both usable now? I thought current impl is capabel to use only --build-config-find
Actually.. are both usable now? I thought current impl is capabel to use only --build-config-find
It should be. There is a new method in the Options.Configuration class, findConfigFile()
,which ensures that if you give it a build directory (as the current comparator implementation does) and the user specified --job-config-find
, it will go two steps up to the job directory...
nn, I mean in the queries. The --build-config-find is used eg for nvr. What is --job-config-find used for? Answer - IIUC - nothing, but will be usefull in that future query which may repalce regex? If so, I would liek to remov it rom this PR, and incorporate it only in the second one. I do not want to force you to do that, but I need soem reason what it is good for now :). Or to understand what I miss.
pls once you feel thsi is complete. let me know, or mervge on your own. So it is in main, sued, and tested, and you can rebase your second work on top of it.
Work in progress
I changed the way the comparator is looking for NVR. I tried to make the system as general as possible, so it can maybe be used for other things in config files other than just NVR.
The logic of finding things in the config itself is in the lib module in
ConfigFinder
class. For now, it only works with xml files and XPath (I tried comparing the xml parser with the grep-like method on large xml file and the xml parser was faster), however, adding support for json/config/etc should be easy...The comparator has a new general switch:
--config-find filename:whatToFind:findQuery
, to find the nvr, you can for example use:--config-find "build.xml:nvr:/build/actions/hudson.plugins.scm.koji.KojiRevisionState/build/nvr"
. The syntax is quite ugly, I'm looking for suggestions...The comparator finds the value in the config file by the xpath and saves it as the middle part (
whatToFind
), then when it needs the nvr, it looks for the saved value by its name.There is also a new field in the Jenkins config to set the settings (and it automatically adds the switch to the generated buttons to comparator).
What do you thing? Should I continue in this path? I can scratch it and start again if its not ideal.