Needed in Buildah (and potentially Podman later on) where some options
must be overridden. Ultimately this should be avoided whenever possible
but this is not my goal at the present.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Commit 395ba05c44 implemented a POC to allow for changing the behavior
when loading multiple container.conf files in sequence. By default, the
TOML encoder will override existing data/fields with the one specified
in the loaded file. The POC has demonstrated how this behavior can be
changed to append string slices instead of overriding/replacing them
entirely.
This change is the first step of integrating these appendable string
arrays into containers.conf and starts with enabling the `Env`,
`Mounts`, and `Volumes` fields in the `[Containers]` table.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
As discussed in https://github.com/containers/podman/issues/20000, we
need an opt-in mechanism to _append_ string arrays during loading
sequence of containers.conf files.
At the moment, existing fields/data will be overriden with each loaded
config that sets the specified field/option. The TOML (toml.io) config
format does not allow for attributing fields and structs are implicitly
represented as "tables". I wanted to extend a string array with a
simple boolean field, for instance:
```TOML
env=["FOO=bar"]
env.append=true
```
TOML doesn't suppor tthe upper idea as it's not a properly formatted
table. So I looked for alternatives and found that TOML supports
so-called "mixed-type arrays". As the same suggests, such arrays allow
for including more than one type and that seemed like a reasonable
candidate as it allows for _extending_ the existing syntax without
introducing new fields or even yet-another way of loading conf files.
The new format can be seen in the tests. Please note that this is just
a _tested_ POC. Integrating the POC in containers.conf may turn into a
bigger journey as Podman is directly (ab)using many of the fields.
Since they have to be changed to the new type (see POC), Podman will not
compile without changes.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>