Improve management of arguments in scripts
Each script as its own management of arguments right now: it should be managed in only one file and used in every scripts.
@surli could you describe some details on what you thought for the solution of this issue, please? I have the feeling that we are changing/we will change a lot of things in scripts/args, and I feel an unnecessary effort on it as it is now (e.g. to add some arg, like @btellstrom recently did, a lot of files need to be updated, and it's quite easy to forget some), thus I'm thinking in solving this issue here to make the other things easier, even that the priority is minor.
I don't really have the solution for this one. The main problem being that we need to give transmit argument from bash, to java, to docker, to bash again.
I'd like to have a proper way to define all the arguments at one place (say a JSON) and to be able to use it to build automatically the right interfaces for our different tools (Java and bash). Not sure if there is already tools for that of if we have to create a custom one.
It would be really great if it's possible to do something like you said. I will think on a solution and do some research, and when I found an idea I will come back here.
This is just a random idea: what if instead of passing a list of args when calling jars (e.g. the realtime module) we pass just one arg, which is a path to a json file (with all args like you said), and then in the java code we init the config (i.e. RepairnatorConfig) with what is in the json file? In that initialization, the mandatory args for the module called (again, e.g. the realtime) would be checked. For the docker part, we might bind the local json file to the image, instead of passing the env variables. WDYT?
I like the idea for simplifying the management of argument. However we have to take care at 2 things:
-
Debug: the json file you mentioned should always be printed first in some logs for debugging purpose. It must be really painful to debug something if you don't know well the arguments
-
Simple launchers: we currently have launchers that takes simple arguments such as the
repzir_buggy_buildwhich only take a build ID as argument: those scripts shouldn't change. Or at least their arguments shouldn't.
Ok, I will keep these two points in mind.
I think that a good plan would be something like this: I do this for one module (probably the checkbranches, which nobody is working on and there is docker involved), open a PR, and then when everything is good for that module after PR review rounds, I apply the same logic for the other modules for a final PR review. If you have some time, I will mark you as a reviewer for that PR, then we can discuss the details there by my attempts to solve this issue.
ok for me