Commit graph

16 commits

Author SHA1 Message Date
robojerk
56f029cbc0 Complete file structure reorganization for 1:1 osbuild compatibility 2025-08-26 15:38:59 -07:00
David Rheinsberg
e8445da3d9 test: move test_osbuild.py into module tests
Move the `test_osbuild.py` test into the module-test directory. This
test contains just a bunch of basic functionality tests for a selection
of osbuild modules. Hence, it can be run together with the other module
tests.
2020-06-05 09:27:40 +02:00
Christian Kellner
9930f6ebfb test/osbuild: check the schema of sources
Add 'Source' to the list of module classes that will undergo basic
schema checks, i.e. verify that their embedded schema data is valid
JSON schema.
2020-06-02 09:50:14 +02:00
Christian Kellner
131d0264a8 test/osbuild: use new list_modules_for_class
Convert our custom code to list modules to the new ModuleInfo
method list_modules_for_class that does the same thing. This
is then indeed also testing that new function.
2020-05-29 08:37:47 +02:00
Christian Kellner
80858a492b meta: rename StageInfo → ModuleInfo
The are converging on a nomenclature where the sum of Stages,
Assemblers, Sources (and future entities like those) together
are called 'Modules'.
Thus rename StageInfo to ModuleInfo and the corresponding
variables and methods.
2020-05-29 08:37:47 +02:00
Christian Kellner
f3a4b2dfbf test/osbuild: add checks for Schema class
Basic checks that `Schema`, initialization with no, an invalid
and a valid schema. Check the latter can be used to do validation.
2020-05-06 15:42:23 +02:00
Christian Kellner
26ca79ec25 test/osbuild: also validate the schema of stages
Up until now it was verified that loading the `STAGE_OPTS` data
works, i.e. that it contains valid JSON, but the schema itself
was not verified. Use the new `Schema.check` method to do that.
2020-05-06 15:42:23 +02:00
Christian Kellner
3f0ced73ed test/osbuild: use StageInfo to verify stage opts
Instead of manually loading the schema information of the stages
and assemblers, use the new osbuild.meta.StageInfo class.
2020-05-06 15:42:23 +02:00
Christian Kellner
bab736dd9a test/osbuild: add checks for validation
Add checks for the new validation API, specifically check that
errors in the main manifest, the stages and stage options,
assembler and assembler options. Also ensure that there are no
duplicated errors due to pipeline nesting (e.g. build pipelines).
2020-05-06 15:42:23 +02:00
David Rheinsberg
72be939521 test: fix minor pylint warnings
This fixes a bunch of minor pylint warnings:
  * Drop unused imports.
  * Fix "inline-JSON" formatting.
  * Fix space before/after brackets.
  * Use `_` for unused variables.
  * Break overlong lines.
  * Mark unittest as `no-self-use` if applicable.
  * Drop spurious newline at end of file.
2020-04-20 18:58:26 +02:00
Tom Gundersen
481213a8dd pipeline: pin the sources options in the pipeline object
Make the sources options a static property of the pipeline, in
particular of each stage, rather than being passed in on `run()`.

This more closely matches the intended semantics of sources and
pipeline having similar lifetimes and being fairly coupled together.

The difference between the pipeline and the sources is that the
sources do not contribute to identifying the pipeline (they are not
part of the hash for the pipeline id), and they could be swapped
out without changing the output image (as long as they are valid).
However, a pipeline without A sources object would not be useful,
and typically the pipeline and the sources are generated, passed
around and used together.

This is different from the build environment and the secrets object,
which both are specific to either the host or the caller, unlike
the pipeline which should be universal.

This changes the `load()` function to take a `manifest`, which is
a map containing both the pipeline and the sources.

Note that the semantics of the build-env parameter remains unchanged:
It shares the sources with the rest of the pipeline. We may want to
reconsider this in future commits, as the build-env is specific to
the host, whereas the regular pipeline is not.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-02-19 15:59:11 +01:00
Christian Kellner
56a8586bab test: verify all stage options are valid json
Load all stages and assemblers and verify that the json in
STAGE_OPTS is actually valid json.
2020-01-28 13:10:14 +01:00
Lars Karlitski
64713449ce Introduce runners
We've been using a generic `osbuild-run`, which sets up the build
environment (and works around bugs) for all build roots. It is already
getting unwieldy, because it tries to detect the OS for some things it
configures. It's also about to cause problems for RHEL, which doesn't
currently support a python3 shebang without having /etc around.

This patch changes the `build` key in a pipeline to not be a pipeline
itself, but an object with `runner` and `pipeline` keys. `pipeline` is
the build pipeline, as before. `runner` is the name of the runner to
use. Runners are programs in the `runners` subdirectory.

Three runners are included in this patch. They're copies of osbuild-run
for now (except some additions for rhel82). The idea is that each of
them only contains the minimal setup code necessary for an OS, and that
we can review what's needed when updating a build root.

Also modify the `--build-pipeline` command line switch to accept such a
build object (instead of a pipeline) and rename it accordingly, to
`--build-env`.

Correspondingly, `OSBUILD_TEST_BUILD_PIPELINE` → `OSBUILD_TEST_BUILD_ENV`.
2019-11-25 13:05:22 +01:00
Lars Karlitski
fd37a5d646 pipeline: introduce output id
Introduce and output id, which is the checksum over a full pipeline,
including all stages and the assembler. The id of a pipeline did not
include assemblers before. To be less confusing, rename the existing id
to "tree id".
2019-09-25 23:50:50 +02:00
Tom Gundersen
0a9223b6f2 Pipeline: drop the build setter
Take this as an argumnet to __init__ in the same way that `base`
is.

This avoids us having to deal with the case of someone setting a
stage before the build, which does not work as the stage id will
be wrong.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-08-13 17:13:13 +02:00
Lars Karlitski
054fea3d83 osbuild: add description() methods
We already allow loading from a description. This adds the opposite
direction to export Pipelines, Stages, and Assemblers.
2019-08-07 10:01:17 +02:00