Commit graph

1966 commits

Author SHA1 Message Date
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
Christian Kellner
d04ce2e1ef stages: add new org.osbuild.udev.rules stage
Add new stage to create udev rules files; add a simple stage test
to check for basic functionality.
2022-05-06 12:46:03 +02:00
Alexander Larsson
9bbe024ba2 org.osbuild.luks2.format: Support dm-integrity
I've been looking at:
  https://archive.fosdem.org/2018/schedule/event/cryptsetup/attachments/slides/2506/export/events/attachments/cryptsetup/slides/2506/fosdem18_cryptsetup_aead.pdf

And it seems if you want integrity checking, dm-crypt is not enough,
but should be combined with dm-integrity. This allows this by using
the --integrity option with cryptsetup.

It should be noted that the slides above mention that this is marked
experimental in the docs because the existing algorithms usable for
this is a bit slow. Something to be aware of if you want to use this.
2022-04-30 15:26:16 +02:00
Christian Kellner
061c2012ed stage/ostree.passwd: also merge /etc/sub{u,g}id
When merging user and group database from individual commits also merge
the corresponding /etc/sub{u,g}id database. These are created when the
users are added via `useradd` and thus also need to be imported with
the corresponding users.
2022-04-28 14:38:24 +01:00
Christian Kellner
1e4507c3d6 util/ostree: new class to store subordinate ids
Add a new class `SubIdsDB` as a database of subordinate Ids, like the
ones in `/etc/subuid` and `/etc/subgid`. Methods to read and write
data from these two files are provided.
Add corresponding unit tests.
2022-04-28 14:38:24 +01:00
Christian Kellner
b57376d160 pipeline: drop CAP_MAC_ADMIN by default
Drop `CAP_MAC_ADMIN` from the default capabilities which is needed
to write and read(!) unknown SELinux labels. Adjust the stages
that need to read or write SELinux labels accordingly.
2022-04-27 23:05:11 +01:00
Christian Kellner
0c8f5c7ef0 pipeline: drop CAP_{NET_ADMIN,SYS_PTRACE} caps
Drop CAP_{NET_ADMIN,SYS_PTRACE} from the default capabilities which
are only needed to run bwrap from inside a stage which is done by
the `ostree.commit` and `ostree.preptree` stages, so retain them
directly there.
2022-04-27 23:05:11 +01:00
Christian Kellner
d14e5f3ee8 meta: ability to specify capabilities for stages
Add new stage metadata `CAPABILITIES` where stages can request
additional capabilities that are not in the default set.
Currently this is not used by any stage since the default set
contains the sum of all needed capabilities.
2022-04-27 23:05:11 +01:00
Christian Kellner
bdcc9ea218 pipeline: retain minimal required capabilities
Drop all capabilities that are not required by any of the stages.
N.B. at least one stage (`ostree.preptree`) itself executes bwrap
itself, which in turn needs `CAP_SYS_PTRACE` and `CAP_NET_ADMIN`.
2022-04-27 23:05:11 +01:00
Christian Kellner
4ac62abbc3 buildroot: ability to drop capabilities
Add a new member variable `caps` that if not `None` indicates the
capabilities to retain, i.e. all other capabilities not specified
will be dropped via `bubblewrap` (`--cap-drop`).
Add corresponding tests.
2022-04-27 23:05:11 +01:00
Christian Kellner
1874c71920 util/linux: add capability utilities 2022-04-27 23:05:11 +01:00
Christian Kellner
46fd8958bb test/util: convert util_linux to pytest
Convert the test from `unittest` to `pytest`. No semantic change.
2022-04-27 23:05:11 +01:00
Christian Kellner
4055774c7b test: remove old pipelines directory
Left over from the conversion of pipeline tests to test/data/manifests
and MPP via commits 7dcc946 and 020e78d.
2022-04-27 23:01:26 +01:00
schutzbot
d6b8839f39 Post release version bump
[skip ci]
2022-04-27 13:30:13 +00:00
Christian Kellner
090f768544 devices/lvm2.lv: add support for lvm devices files
LVM2 introduced system.devices as an alternative way to filter
devices. Since we create devices in a stage the devices won't be
added to the /etc/lvm/devices/system.devices file since /etc/ is
inside the container. As a result the we can't see these devices
and will fail with "Could not find parent device".
Therefore we add support for managing our own per-service devices
file, iff a `system.devices` is present.
2022-04-25 20:38:02 +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
0fe7196c7a inputs/ostree: extract per-ref options schema
Extract the schema for the per-reference options, which in this case
confusingly is the single property "ref".
2022-04-21 16:39:58 +02:00
Christian Kellner
c25857020d test/fmt_v2: add simple check for input references
Specifically this test checks that the order given in the manifest is
preserved when loaded, i.e. the internal dict has the keys ordered in
the same way, independently in which way they were specified -- list
or object.
2022-04-21 16:39:58 +02:00
Christian Kellner
df91d8916d inputs/tree: enforce constraints for plain refs
When using "plain refs", that is, when using an array of strings,
we did not enforce the constraints of exactly one reference. This
was done for dictionary references.
2022-04-21 16:39:58 +02:00
Christian Kellner
ae7ab67cfa inputs/ostree: fix typo
Lets put the `a` back in `dictionaries`.
2022-04-21 16:39:58 +02:00
Christian Kellner
bc99cd9c19 inputs/container: prefix unused arguments with _
The `data` argument is not used, prefix it with `_` so that pylint
knows this is intentional.
2022-04-21 16:39:58 +02:00
Christian Kellner
3e1ecf15b6 inputs/containers: remove unneeded input
The `pathlib` is not used, remove it.
2022-04-21 16:39:58 +02:00
Christian Kellner
136e13eca1 buildroot: don't explicitly add CAP_MAC_ADMIN
This is a left-over from the time when `systemd-nspawn` was used,
which only retained a limited set of capabilities which did not
include `CAP_MAC_ADMIN`[1]. Bubblewrap, on the other hand, retains
all currently capabilities if the process is run as root[2].

[1] see e.g. src/nspawn/nspawn.c#L147 of commit c52950c
[2] see commit abc56644566a6095bb72a5bf70fcee7dd90e9447
2022-04-20 12:05:36 +01:00
Alexander Larsson
68481f48ae Support specifying multiple devices in all mkfs versions (like xfs)
mkfs.xfs already has `additionalProperties: true` for the devices
section, as this is necessary for example when creating lvm2 setups.
This should be possible for other filesystem types too.
2022-04-19 18:00:15 +02:00
Jelle van der Waa
4eb35babed inputs/org.osbuild.tree: fix typo 2022-04-16 15:39:15 +02:00
Jakub Rusz
b7a9e9c5a3 workflows/trigger-gitlab: run Gitlab CI in new image-builder project
We have a new project in Gitlab
https://gitlab.com/redhat/services/products/image-builder/ci/osbuild
and we want to run the CI there instead.
2022-04-14 14:42:50 +02:00
schutzbot
896c897afc Post release version bump
[skip ci]
2022-04-13 13:23:19 +00:00
Jakub Rusz
008d013e1c ci: run ci-details.sh
This script collects useful information about CI runners.
2022-04-13 14:57:27 +02:00
Jakub Rusz
62f2bf608c tools: add set-env-variables.sh
Very simple script to set env variables.
2022-04-13 14:57:27 +02:00
Jakub Rusz
a5b42a84f2 mockbuild: use rpmrepo in mock templates
We're using rpmrepo snapshots as system repositories on the runners, so
let's use them also for mockbuild.
2022-04-13 14:57:27 +02:00
Jakub Rusz
700a893cf8 Schutzfile: add Schutzfile
Schutzfile contains rpmrepo snapshots for various CI runners that are
used as system repositories to mitigate broken dependencies and similar
issues.
2022-04-13 14:57:27 +02:00
Tomas Hozza
f41edba1fb Support VMDK subformat in qemu assembler 2022-04-07 15:51:44 +02:00
Tomas Hozza
bbe6127ddb Stages: support vmdk subformat in the qemu stage
Support specifying the subformat for the `vmdk` image type in the
`org.osbuild.qemu` stage.
2022-04-05 15:01:34 +02:00