Commit graph

13 commits

Author SHA1 Message Date
David Rheinsberg
4b09088661 test/isort: apply diff to full tree
Apply the isort modifications to the entire source tree, not just the
selected python files of test-src.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-09-23 12:08:10 +02:00
Christian Kellner
99abc1373d inputs: support array of objects references
This extends the possible ways of passing references to inputs. The
current ways possible are:
 1) "plain references", an array of strings:
    ["ref1", "ref2", ...]
 2) "object references", a mapping of keys to objects:
    {"ref1": { <options> }, "ref2": { <options> }, ...}

This patch adds a new way:
  3) "array of object references":
    [{"id": "ref1", "options": { ... }}, {"id": ... }, ]

While osbuild promises to preserves the order for "object references"
not all JSON serialization libraries preserve the order since the
JSON specification does leave this up to the implementation.

The new "array of object references" thus allows for specifying the
references together with reference specific options and this in a
specific order.

Additionally this paves the way for specifying the same input twice,
e.g. in the case of the `org.osbuild.files` input where a pipeline
could then be specified twice with different files. This needs core
rework though, since internally we use dictionaries right now.
2022-04-21 16:39:58 +02:00
Christian Kellner
f4a8770e58 inputs/files: support for pipeline origins
Currently the `org.osbuild.files` input only supports the source origin.
Extend support to mapping files from pipelines, using the recently added
sub-tree reading capability of `ObjectStore.reat_at`. Restructure the
JSON schema to keep is as readable as possible.
2021-06-09 18:37:47 +01:00
Christian Kellner
659c139ed1 inputs/files: extract source options schema
This is mostly to prepare the support for pipeline options will be
different for pipeline origins than source origins.
2021-06-09 18:37:47 +01:00
Christian Kellner
e92b24229d inputs/files: extract origin definition
This is mostly to prepare the support for pipeline origins where
this node will get reused in more than one place.
2021-06-09 18:37:47 +01:00
Christian Kellner
a2c926654c inputs/files: rename refs to files
The `org.osbuild.files` input provides individual files to a stage.
Change the `refs` key in the returned dict to `files` to better
reflect that fact. Also adapt the documentation to indicate that
the keys actually paths and not necessarily checksums. This prepares
for future extension of the `files` input to pipeline origins.
2021-06-09 18:37:47 +01:00
Christian Kellner
a3ea8dc748 inputs/files: use os.link instead of ln binary 2021-06-09 18:37:47 +01:00
Christian Kellner
1ed85dc790 inputs: convert to host service
Create a `InputService` class with an abstract method called `map`,
meant to be implemented by all inputs. An `unmap` method may be
optionally overridden by inputs to cleanup resources.
Instantiate a `host.ServiceManager` in the `Stage.run` section and
pass the to the host side input code so it can be used to spawn the
input services.
Convert all existing inputs to the new service framework.
2021-06-09 18:37:47 +01:00
Christian Kellner
08bc9ab7d8 inputs: pre-defined input paths
Instead of bind-mounting each individual input into the container,
create a temporary directory that is used by all inputs and bind-
mount this to the well known location ("/run/osbuild/inputs"). The
temporary directory is then passed to the input so that it can
make the requested resources available relative to that directory.
This is enforced by the common input handling code.
Additionally, pass the well known input path via a new "paths" key
to the arguments dictionary passed to the stage.
2021-06-09 18:37:47 +01:00
Christian Kellner
2b19e534e6 inputs/files: extract sources definition
Make the main portion of the schema more readable by extracting the
two possible reference definitions.
2021-06-09 18:37:47 +01:00
Christian Kellner
d577a306f9 inputs/files: extract metadata schema
Make the schema more readable by extracting the metadata definition.
2021-06-09 18:37:47 +01:00
Christian Kellner
c9462bf48c inputs: add "type" property to schema
This was missed when `type` was added to the Inputs class.
2021-02-12 15:55:43 +01:00
Christian Kellner
1f89d2fd9d inputs: add files input
Create a new input for resources of the `org.osbuild.files` type,
i.e. individual files, addressed in the store via their content
hash.
2021-02-06 12:04:30 +01:00