Commit graph

1998 commits

Author SHA1 Message Date
Christian Kellner
2d78a0bbea pipeline: separate object creation from access
Check for existing checkpoint in `Pipeline.build_stages` by trying to
get the object, instead of just checking for its existence. Later, if
no checkpoints were found, i.e. `tree` is `None`, create a new object.
This avoids mixing of new object creation and object access.
2022-06-21 15:08:32 +02:00
Christian Kellner
458e2063c9 pipeline: use deque to track stages to be built
Instead of iterating over the stages via indices, iterate over the
stages directly. To be able to do so, collect the stages that need
to be built in a deque and then drain it from the other end.
2022-06-21 15:08:32 +02:00
Christian Kellner
d70a8d6419 pipeline: always invoke monitor.finish
Also invoke `monitor.finish` when the pipeline failed to built.
There is no need to not invoke it in that case. This also will
allow us to print some information in the monitor in tha case.
2022-06-21 15:08:32 +02:00
Christian Kellner
9cb9a0d817 pipeline: simplify short circuit code
Since neither a build tree, nor the actual tree is returned from
`build_stages` the short circuit code that checks if the tree is
already present in the store, can be moved before the build tree
retrival. As a result, the short-circuit check in `Pipeline.run`
is now redundant. It was there to make sure that if we have the
tree associated with a pipeline, its build pipeline would also
not be needed. With the short-circuit now happening before the
access of the build pipeline in `build_stages` this is ensured.
2022-06-21 15:08:32 +02:00
Christian Kellner
bd28a29b85 pipeline: do not return tree from build_stages
In the previous data model the build pipelines were nested inside
the pipeline and thus we would recurse in `build_stages`. The
tree that was built was returned and potentially became the build
tree for the pipeline that invoked `build_stages`. In the new
model of a direct acyclic graph of pipelines the build tree can
be any previously built pipeline and we just get it via the store,
which now keeps track of all previously built pipelines even if
there are not committed to it. Thus there is no need to return
the trees from `build_stages` anymore.
Adjust the short code that does the short circuit check to use
`ObjectStore.contains` instead of `ObjectStore.get` since we
do not need to object anymore.
2022-06-21 15:08:32 +02:00
Christian Kellner
ba6c07f406 pipeline: remove build_tree return value
The pipeline data model used to have an assembler optionally
associated with the pipeline; therefore we had to return the
build tree used to to build the stages since the same build
tree also needed to be used from the assembler. In the "new"
model (first introduced in version 27), the assembler got
replaced by another "normal" pipeline. Since then, there is
no need to return the build tree anymore. Remove it.
2022-06-21 15:08:32 +02:00
Christian Kellner
d602b5ff7f stages/mkfs.fat: pass -I command line option
The option will force `mkfs.fat` to ignore existing partitions on
the target device. The check is done via the corresponding device
node in sysfs, i.e. the contents of the `partition` attribute in
`/sys/dev/block/<major>:<minor>`. In certain situations this info
can be stale. Passing `-I` will work-around these situations.
2022-06-20 11:19:33 +02:00
Jakub Rusz
773412e5b5 Schutzfile: update rpmrepo snapshots 2022-06-16 14:24:02 +02:00
Jakub Rusz
2ea15b967d tests: Update testing to RHEL-8.6 GA 2022-06-16 14:24:02 +02:00
Jakub Rusz
bd7d2a5628 rpmbuild: add RHEL 8.7 and 9.1 nightly 2022-06-16 14:24:02 +02:00
Jakub Rusz
1e7ba87eb7 mockbuild: update mockbuild script after RHEL-9 GA
Removing rhel-9 templates as they are shipped upstream already and
making necessary modifications to mockbuild.sh
2022-06-16 14:24:02 +02:00
Christian Kellner
86123da599 stages/qemu: expose vpc options
Currently we hard code the vpc options `subformat=fixed` and
`force_size`, which are needed to generate valid azure images
with newer versions of qemu. But for other use cases or other
versions of qemu these options might not be wanted or valid.
Expose all the options but with defaults corresponding to the
old behavior.
Add a unit test for the `force_size` option to check its
effect. Also add a check for the correct size to the existing, 
default value (i.e. `force_size` being `true`).
2022-06-15 13:41:11 +02:00
Simon Steinbeiss
3ffba19205 ci: Adjust release schedule timer
Adjust the timer for our automated releases to trigger the workflow at
8 UTC. This corresponds to 10am in most of our team's timezone and to
the reminder event in our team calendar.
2022-06-15 11:47:41 +02:00
Achilleas Koutsou
c8073b5836 sources: support calling curl with --insecure
Add support for the `--insecure` curl flag, which makes curl skip the
verification step when making secure connections (e.g., https://).
This allows osbuild to download files from servers configured with
SSL/TLS but whose certificate cannot be validated.

This is supported for configuring repository sources in
osbuild-composer.
2022-06-14 22:13:39 +02:00
Christian Kellner
3ab2ddd481 pipeline, fmt: use build result object internally
Instead of serializing the `BuildResult` to a dict in `build_stages`,
we keep the object and then only serialize it in the corresponding
formatting code. This doubles down on the separation between the
internal data structures and the external representation of them. It
was partially already done in the v2 format which hand-picked which
elements of the BuildResult it would return for each stage.
2022-06-14 00:15:51 +01:00
Christian Kellner
d235e4c26a pipeline: remove options from build result
Remove the stage options from the `BuildResult` object. They were
only serialized in the case of version 1 and not actually used by
Composer for anything. Use of v1 manifests should very limted now
anyway.
2022-06-14 00:15:51 +01:00
schutzbot
a96ee0f8ba Post release version bump
[skip ci]
2022-06-08 13:32:41 +00:00
Alexander Todorov
20b8c67c8d ci: Disable -nightly test runners for 8.6 and 9.0 2022-06-08 14:18:42 +02:00
Alexander Todorov
b7ad41b9b4 ci: Remove 8.6 & 9.0 nightly repo definitions from Schutzfile 2022-06-08 14:18:42 +02:00
Alexander Todorov
8884b4cac8 COMPOSER-1576: Start building RPMs on 8.6 & 9.0 GA 2022-06-08 14:18:42 +02:00
Alexander Todorov
222023bc31 COMPOSER-1593: Retire Fedora 34 from CI 2022-06-08 14:18:42 +02:00
Gianluca Zuccarelli
4ede85f176 test/data: add oscap.remediation tests
Add new tests for the `oscap.remediation`
stage.
2022-05-31 01:32:49 +02:00
Gianluca Zuccarelli
66d2cf6df5 stages: add oscap-remediation stage
Add a new stage to handle openscap first boot
remediation. The openscap-remediation.service
looks for a `/system-update` symlink which
points to an openscap config file. This stage
creates both the necessary configuration and
the `/system-update` symlink.
2022-05-31 01:32:49 +02:00
Simon de Vlieger
ce9253788e tests: handle - in the sfdisk version test
When a `-` is in the version (meaning a version such as: `2.38-rc1`),
take only the part before the dash.

This closes #1036.
2022-05-30 16:04:03 +02:00
Christian Kellner
16b187f5d9 test: add grub2.legacy test
Add a basic check for the org.osbuild.grub2.legacy stage.
2022-05-29 14:02:16 +02:00
Christian Kellner
e1c2d642dc stages/grub2.legacy: replace arch with platform
The `architecture` served two purposes: 1) the selection of the loader
and 2) the selection of the platform. Instead of inferring the latter
from `architecture`, it is now explicitly specified as a property of
the `bios` value, which in turn was transformed into an object.
The loader is still inferred but since `bios` is an object now there
is the option of adding an explicit `loader` option to it.
All this should make it more transparent what is happening and is
also more in line with the normal `grub2` stage.
2022-05-29 14:02:16 +02:00
Christian Kellner
dcc56d083f stages/grub2.legacy: make schema stricter
The code requires that `id`, `product` and `kernel` are defined for
each entry. Reflect that in the schema. Require at least one entry.
2022-05-29 14:02:16 +02:00
Christian Kellner
8137597ac4 stages/grub2.legacy: use x86 instead of x64
The usage `x64` is to specific since we could indeed boot 32 bit
`x86`, so just use that.
2022-05-28 17:13:17 +01:00
Christian Kellner
b96ee08ce1 stages/grub2.legacy: make the "bios" option a bool
We use an internal mapping from `architecture` to the needed
grub2 platform identifier, there is no need to pass it in.
Change it to a boolean.
2022-05-28 17:13:17 +01:00
schutzbot
cd5de55657 Post release version bump
[skip ci]
2022-05-25 13:31:04 +00:00
Simon de Vlieger
7b0e1fe5fd sources: curl max_workers 2 * num_cpus
This changes the curl source to use the number of cpus times two
for its thread count. A conservative number but a commonly used
default.
2022-05-24 19:45:23 +02:00
Christian Kellner
e0fbbdaa5e stages: add new sgdisk stage
Can be used to create partition tables via GPT laypout via `sgdisk(8)`.
The schema of `partitions` is intentionally kept identical to the one
in `org.osbuild.sfdisk`.
Add corresponding tests.
2022-05-23 13:00:44 +02:00
Christian Kellner
5edb54bc2d test/data: add gdisk to fedora 34 v2 build root
Will be use in later test. Separated as its own commit for clarity.
2022-05-23 13:00:44 +02:00
Christian Kellner
e51d08ba9e stages/ostree.passwd: fix subid source path
The sub{g,u}id files in the commit are located in `/usr/etc` not
`/etc`. Read the files from there.
2022-05-16 17:51:56 +02:00
Christian Kellner
20daf92cf3 stages/udev.rules: use correct separator
The key-value-operator expressions should separated by comma
not space. Fix this.
2022-05-16 17:19:40 +02:00
Simon de Vlieger
6997cff9c0 meta: show stage name when schema is missing
Show the stage name (if one is set) when failing the stage in the
validator. This closes #1007, example output:

```
€ python3 -m osbuild supakeen-os.json
supakeen-os.json has errors:

pipelines[0].stages[0]
  could not find schema information for 'org.osbuild.rpmb'

  .pipelines[0].stages[0].inputs.packages:
    could not find schema information for 'org.osbuild.filesz'
```
2022-05-11 17:34:12 +02:00
schutzbot
f23ec6eebe Post release version bump
[skip ci]
2022-05-11 13:36:52 +00:00
Thomas Lavocat
ac2a194cd4 sources: check if ostree object exists in cache
The generic ways of checking if an object is in the cache does not apply
for ostree as the internal structure of a repo is quite specific. Thus
we need to use the ostree executable to ask it to explore its repo for
us.
2022-05-11 04:32:42 -05:00
Thomas Lavocat
441e67a6f6 ostree: show commit metadata
This new API call allows one to check (among other things) if a commit
exists in a repo. It'll throw a RuntimeException if the commit is
missing.
2022-05-11 04:32:42 -05:00
Thomas Lavocat
1de74ce2c9 sources: generalizing download method
Before, the download method was defined in the inherited class of each
program. With the same kind of workflow redefined every time. This
contribution aims at making the workflow more clear and to generalize
what can be in the SourceService class.

The download worklow is as follow:
Setup -> Filter -> Prepare -> Download

The setup mainly step sets up caches. Where the download data will be
stored in the end.

The filter step is used to discard some of the items to download based
on some criterion. By default, it is used to verify if an item is
already in the cache using the item's checksum.

The Prepare step goes from each element and let the overloading step the
ability to alter each item before downloading it. This is used mainly
for the curl command which for rhel must generate the subscriptions.

Then the download step will call fetch_one for each item. Here the
download can be performed sequentially or in parallel depending on the
number of workers selected.
2022-05-11 04:32:42 -05:00
Thomas Lavocat
0953cf64e0 sources: provide an unverified tmpdir
Some downloading program need a global unverified tmpdir to work within
before storing the definitive data. Provide this in the workflow
directly.
2022-05-11 04:32:42 -05:00
Thomas Lavocat
128845da3c sources: tidy the download method
Only the "items to download" need to be passed as parameters. The rest
is unpacked as attributes during the Setup step of the workflow.
2022-05-11 04:32:42 -05:00
Thomas Lavocat
92fe237f24 sources: introduce per-source content_type
Introduce a new class member `content_type` that specifies what type of
items the source will store in the cache. Use that to generalize the
setup step, which is shared across all sources.
2022-05-11 04:32:42 -05:00
Thomas Lavocat
34cd9ef9f0 sources: generalize cache generation
Introduce a `setup` step in the workflow that is responsible of
generating the cache folder. This is then used in each download method.
2022-05-11 04:32:42 -05:00
Simon Steinbeiss
5337374b50 packit: Enable Koji build integration
Also drop the create_pr option, which was dropped by Packit.
2022-05-10 16:32:11 +02:00
Christian Kellner
c384639aed setup.cfg: enable attribute-defined-outside-init
This warning was globally disabled in commit c124ab2, due to dynamic
attributes of the `LoopInfo` class. This false positive is silenced
locally now. Some actual positives have meanwhile made it into the
code base, but have fixed via previous commits so we can now enable
W0201/attribute-defined-outside-init again.
2022-05-06 17:33:23 +02:00
Christian Kellner
91d38916a6 loop: silence W0201 (attribute outside init) in set_status
Silence pylint warning W0201 (attribute-defined-outside-init) in
`set_status`; it sets dynamic attributes on the LoopInfo class
which pylint does not recognize.
2022-05-06 17:33:23 +02:00
Christian Kellner
f2aa688d3e test/monitor: properly initialize output
It was not initialized in `__init__`, do so.
2022-05-06 17:33:23 +02:00
Christian Kellner
b94b90b8e2 monitor: small whites pace fix
Extra line between class comment and `__init__`.
2022-05-06 17:33:23 +02:00
Christian Kellner
1bcbf3a2d2 monitor: properly initialize timer_start
It is set in `module()` which must be called before `result` so the
actual usage was fine, but it was not initialized in `__init__`.
2022-05-06 17:33:23 +02:00