From: Jeny Sheth <jeny.sadadia@collabora.com>
To: kernelci@lists.linux.dev
Cc: Guillaume Charles Tucker <guillaume.tucker@collabora.com>
Subject: Enabling TOML support for user settings
Date: Tue, 6 Jun 2023 12:42:26 +0530 [thread overview]
Message-ID: <0d91ed78-e648-d41e-1f29-2eb7dbb488ae@collabora.com> (raw)
Hello everyone,
We have enabled TOML support for user settings in KernelCI-Core.
Python package `toml` has been integrated to parse the settings file.
Please see the Github issue[1] for more details on this transition.
The sample config file `kernelci.toml.sample`[2] has been added to the
repository.
As per the former convention with `.conf`, we will continue having a
`DEFAULT` section and other sections for different command line tools in
the `.toml` file.
For example:
```
[DEFAULT]
storage = "http://localhost:5002"
db_config = "localhost"
api_config = "docker-host"
[kci_build]
build_config = "next"
arch="x86"
j = 3
```
With TOML, we can use different data types for values (strings with
double quotes, integers, float). Unlike `configparser` this removes the
need for data type conversion for values.
Components such as database, labs, and storage will follow the
convention of the form ["storage:docker-host"].
For the correct parsing from TOML decoder, we need to use double quotes
around the name when it includes ":".
Below is the example for more detail:
```
["lab:my-lava-lab"]
user = "user-name"
lab_token = "1234-5678"
["db:staging.kernelci.org"]
db_token = "XXX-XXXX-XXXX-XXXX"
api = "https://api.staging.kernelci.org/"
```
Another suggestion is to use dotted keys instead of ":" for the above
section names. That way we can remove double quotes around the section
name. However, that can cause issues when we have dotted values e.g.
"staging.kernelci.org".
If we go with the dotted name, it will look like
[db.staging.kernelci.org] and the parser will assume that it is a nested
dictionary.
For example:
```
[db.staging.kernelci.org]
api = "https://api.staging.kernelci.org/"
```
Above will be parsed as:
```
'db': {'staging': {'kernelci': {'org': {'api':
'https://api.staging.kernelci.org/'}}}}
```
To overcome that, we can use double quotes around the value for dotted
notation.
Something like this:
```
[db."staging.kernelci.org"]
api = "https://api.staging.kernelci.org/"
```
That will be parsed as:
```
'db': {'staging.kernelci.org': {'api': 'https://api.staging.kernelci.org/'}}
```
We would like your comments/suggestions to select the best approach
possible here for naming conventions. Please check out the discussion[3]
here and feel free to provide your input.
The `kernelci-pipeline` has already started adapting to this new format.
This is the work in progress[4] for reference.
Standard locations for the file are the same as `kernelci.conf` file i.e.
- kernelci.toml in the current working directory
- ~/.config/kernelci/kernelci.toml for per-user settings
- /etc/kernelci/kernelci.toml for system-wide settings
Along with this new format, we are still keeping support for the old
`kernelci.conf` for now. However, It is recommended to switch from the
`.conf` to `.toml` as the older format will eventually be deprecated.
We are planning to support the older format until we move from the old
backend to the new API. As per the planning, the transition will take
place by the end of 2023. Suggestions for deciding the deprecation
timeline are welcome.
Thanks,
Jeny
[1] https://github.com/kernelci/kernelci-core/issues/1913
[2] https://github.com/kernelci/kernelci-core/blob/main/kernelci.toml.sample
[3]
https://github.com/kernelci/kernelci-core/issues/1913#issuecomment-1572217965
[4] https://github.com/kernelci/kernelci-pipeline/pull/266/
next reply other threads:[~2023-06-06 7:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 7:12 Jeny Sheth [this message]
2023-06-16 11:36 ` Enabling TOML support for user settings Guillaume Tucker
2023-07-31 10:01 ` Jeny Sheth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d91ed78-e648-d41e-1f29-2eb7dbb488ae@collabora.com \
--to=jeny.sadadia@collabora.com \
--cc=guillaume.tucker@collabora.com \
--cc=kernelci@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.