How is configuration specified in Mozharness?
- A script can define an optional initial config, as a dictionary or a config file.
Next, if we specify
--config-file FILEon the command line, that file's contents will be added to
Finally, command line options are added to
If the same config key is specified in multiple locations, the command line takes precedence over the config file, which takes precedence over the initial config [file].
command line options > config file > initial config > initial config file)
How does a script add command line options?
The command line options are all optparse-based.
What does a config file look like?
We can currently specify anything here. I have a config file well-formedness checker, but I'd love to test for misspellings or missing/extraneous config options as well.
How do we set the config to read-only?
I cover why here.
What is the volatile config?
After locking the read-only config, mozharness dumps a copy of the running config in a file called
localconfig.json, which can be reused or inspected later.
If you specify set of actions to run, that information will currently be saved with the rest of your config. The next time someone runs the script with that config file, that set of non-default actions might be unexpected and undesirable.
Previously, I discarded action config before dumping that file. In the talosrunner branch, I'm now moving action-specific config to self.config['volatile_config']; we'll have the choice whether to re-use that or ignore it in future runs.
If I ever fully support
--noop, that will likely be another candidate for a volatile config option.