Commit graph

142 commits

Author SHA1 Message Date
Renata Ravanelli
cdcb4598bb create org.osbuild.bootupd stage
Add the bootupd stage to install GRUB on both BIOS and UEFI systems,
ensuring that your bootloader stays up-to-date.

Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
2024-01-10 01:15:18 +01:00
Dusty Mabe
ce8408a9c6 mounts: support mounting partitions
This allows us to map in a whole disk as a loopback device with parition
scanning rather than slicing up the disk and creating several loopback
devices. Something like this:

```
      - type: org.osbuild.copy
        inputs:
          tree:
            type: org.osbuild.tree
            origin: org.osbuild.pipeline
            references:
              - name:tree
        options:
          paths:
            - from: input://tree/
              to: mount://root/
        devices:
          efi:
            type: org.osbuild.loopback
            options:
              filename: disk.img
              start:
                mpp-format-int: '{image.layout[''EFI-SYSTEM''].start}'
              size:
                mpp-format-int: '{image.layout[''EFI-SYSTEM''].size}'
          boot:
            type: org.osbuild.loopback
            options:
              filename: disk.img
              start:
                mpp-format-int: '{image.layout[''boot''].start}'
              size:
                mpp-format-int: '{image.layout[''boot''].size}'
          root:
            type: org.osbuild.loopback
            options:
              filename: disk.img
              start:
                mpp-format-int: '{image.layout[''root''].start}'
              size:
                mpp-format-int: '{image.layout[''root''].size}'
        mounts:
          - name: root
            type: org.osbuild.xfs
            source: root
            target: /
          - name: boot
            type: org.osbuild.ext4
            source: boot
            target: /boot
          - name: efi
            type: org.osbuild.fat
            source: efi
            target: /boot/efi
```

now becomes a little more simple:

```
      - type: org.osbuild.copy
        inputs:
          tree:
            type: org.osbuild.tree
            origin: org.osbuild.pipeline
            references:
              - name:tree
        options:
          paths:
            - from: input://tree/
              to: mount://root/
        devices:
          disk:
            type: org.osbuild.loopback
            options:
              filename: disk.img
              partscan: true
        mounts:
          - name: root
            type: org.osbuild.xfs
            source: disk
            partition:
              mpp-format-int: '{image.layout[''root''].partnum}'
            target: /
          - name: boot
            type: org.osbuild.ext4
            source: disk
            partition:
              mpp-format-int: '{image.layout[''boot''].partnum}'
            target: /boot
          - name: efi
            type: org.osbuild.fat
            source: disk
            partition:
              mpp-format-int: '{image.layout[''EFI-SYSTEM''].partnum}'
            target: /boot/efi
```

Fixes https://github.com/osbuild/osbuild/issues/1495
2023-12-22 10:18:29 -05:00
Luke Yang
5fc3b565a2 create org.osbuild.ostree.aleph stage
Similar to the aleph file created for builds of FCOS based on ostree
commit inputs, this adds an aleph file that contains information about
the initial deployment of data when the disk image was built

A new stage is preferred here as both the org.osbuild.ostree.deploy
and org.osbuild.ostree.deploy.container stages need an aleph file and
use of the aleph file may depend on the project/product. For example,
right now CoreOS is the only project that uses an aleph file, but others
may want it in the future.
2023-12-19 17:58:39 +01:00
Dusty Mabe
e077a4ceba manifests/fedora-vars: update to fedora 39
For https://github.com/osbuild/osbuild/pull/1475 we need to pick up
https://bodhi.fedoraproject.org/updates/FEDORA-2023-a3737d3bee so let's
bump to the latest Fedora 39 snapshot.
2023-12-19 17:58:39 +01:00
Ondřej Budai
7882db2543 test/data/manifests: add erofs-utils to Fedora buildroot
The next commit will add a stage test that requires erofs-utils. Let's add it
into the buildroot in a separate commit, so the history is more readable.
2023-12-01 10:36:06 +01:00
Dusty Mabe
e191dc1d0d tools/osbuild-mpp: set part ID from name if missing
For our Fedora CoreOS disk images we set the partition labels (name)
for the partitions. This is also supported using the primitives here
in OSBuild, but it wasn't obvious that I needed to set the name in
the mpp-define-images definition. Let's set the name there, but let's
also allow osbuild-mpp to set the `id`, which is what is used later
to access that partition from the `name` too if `id` isn't set.

This means we allow something like:

   - name: BIOS-BOOT
     type: 21686148-6449-6E6F-744E-656564454649
     bootable: true
     uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
     size: 100

rather than requiring something like:

   - id: BIOS-BOOT
     name: BIOS-BOOT
     type: 21686148-6449-6E6F-744E-656564454649
     bootable: true
     uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
     size: 100
2023-11-29 10:37:08 +01:00
Dusty Mabe
5ad3f968e1 manifests: add example metal4k disk image for Fedora CoreOS
The created disk image would be written to 4k native disks.
2023-11-29 10:37:08 +01:00
Dusty Mabe
2e1f6e2553 tools/osbuild-mpp: support defining multiple image layouts
Right now you can only define a single image, lets add mpp-define-images
and accept a list.
2023-11-29 10:37:08 +01:00
Dusty Mabe
b824e1e57a manifests: fedora-coreos-container: human friendly partitioning
Let's define the partitioning for the example here in a more human
friendly way using GiB and MiB terms. This yields no change in the
generated json.
2023-11-29 10:37:08 +01:00
Dusty Mabe
0529ae79d1 tests: add metal output to fedora-coreos-container manifest
Also switch the qcow2 output to be a "qemu" platform image. This
change takes advantage of the recent org.osbuild.kernel-cmdline.bls-append
stage addition to modify kernel arguments in later pipelines.

To get a qemu image output:

- osbuild --output-directory out/ --export qemu test/data/manifests/fedora-coreos-container.json

To get a metal image output:

- osbuild --output-directory out/ --export metal test/data/manifests/fedora-coreos-container.json
2023-11-14 23:58:08 +01:00
Michael Vogt
f4f0c8f004 tests: remove lvm2 from the fedora-boot test manifest
With lvm2 the generated fedora fc38 boot image boots in degraded
mode with the following error:
```
[root@localhost ~]# journalctl -u lvm2-monitor.service|more
Nov 13 12:52:04 localhost.localdomain lvm[431]:   Failed to create /etc/lvm/devi
ces 2
Nov 13 12:52:04 localhost.localdomain lvm[431]:   Failed to set up devices.
Nov 13 12:52:04 localhost.localdomain systemd[1]: lvm2-monitor.service: Main pro
cess exited, code=exited, status=5/NOTINSTALLED
Nov 13 12:52:04 localhost.localdomain systemd[1]: lvm2-monitor.service: Failed w
ith result 'exit-code'.
Nov 13 12:52:04 localhost.localdomain systemd[1]: Failed to start lvm2-monitor.s
ervice - Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress p
olling.
```
This breaks the `test_boot.py` which expects the system after booting
in `running` state  (from `systemd is-system-running`).

It looks like this is some sort of race with our generated image,
potentially related to selinux, see
https://github.com/lvmteam/lvm2/blob/v2_03_18/lib/device/dev-cache.c#L1842
and note the lines around dm_prepare_selinux_context(). Note
also that `lvm2-monitor.service` runs with `DefaultDependencies=no`
(c.f.
https://github.com/lvmteam/lvm2/blob/v2_03_18/scripts/lvm2_monitoring_systemd_red_hat.service.in#L7)

Given that the official fc38 cloud image does not use lvm2 and that
it's not needed for the boot test this commit simply removes it
from the fedora-boot manifest. This fixes the test.
2023-11-14 10:45:44 -08:00
Michael Vogt
330cd0675b test: refresh test/data/manifests/fedora-boot.json 2023-11-14 10:45:44 -08:00
Ondřej Budai
fd82024153 test/data/manifests: remove F34 manifests
They are no longer used anywhere! We are free!
2023-11-14 10:45:44 -08:00
Ondřej Budai
506d6a7256 test/stages/authconfig: Use centos stream 9 as a base
Authconfig was completely retired from Fedora. In order to keep this stage
covered, this commit changes the test to use CentOS Stream 9, which still
ships this package.
2023-11-14 10:45:44 -08:00
Ondřej Budai
e4933b4fd6 test/run/boot: migrate to a v2 manifest
This commit migrates the test to a brand new V2, F38-based manifest. It's
actually based on osbuild-composer interpretation of the Fedora Cloud Base
image.
2023-11-14 10:45:44 -08:00
Ondřej Budai
23de60cd23 stages/mkdir: fix its schema
The items of an array are defined under the `items` key, not under `paths`.
Let's fix this.

Btw, this is possible because JSON Schema itself doesn't use
additionalProperties = false. This allows extending the schemas easily, but
is sadly a bit error-prone.

Sadly, since this issue effectively disabled validation of the stage options,
we also need to relax the schema a bit:

We found out that there are manifests in the wild, that use relative paths,
instead of absolute ones. Thus, this commit changes the validation regex to
allow relative paths. However, this now emits a warning and it's strongly
discouraged. The associated stage test was modified to accommodate for this.

Co-authored-by: Tomáš Hozza <thozza@redhat.com>
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-10-30 13:31:15 +01:00
Dusty Mabe
41652343a4 manifests: add fedora-coreos-container example/test
This example shows how to build a qcow2 very similar to the one
delivered by Fedora CoreOS. It uses an input container that has
the Fedora CoreOS OSTree already baked into it, which means that
the OSTree isn't built using this manifest, but taken as an input
from a remote registry.
2023-10-24 13:46:10 -04:00
Dusty Mabe
da07300f38 stages/ostree.deploy: create ostree_commit_deploy function
This drains some of the logic out of `main()` into a
`ostree_commit_deploy()` function. Doing this will make it easier
to diff this stage with the recently added `ostree.deploy.container`
stage.

This commit also changes the `ref` in the schema to be optional,
which is a fixup for 3cc733d. We need to make the ref optional because
the ref could come from the user in the toplevel schema or it could
come from input commit in the schema.
2023-10-24 13:46:10 -04:00
Dusty Mabe
ca3b831c29 manifests/fedora-vars: bump snapshot date
This should correspond to the snapshots from 6b85149.
2023-10-21 07:34:32 +02:00
Dusty Mabe
3cc733d7cd stages/ostree.deploy: support an ostree input
This will allow a user to specify an input directly to the deploy
stage rather than requiring a ostree.pull stage to be called first.

Adding inputs will also be useful when we soon add support for
deploying from a container rather than just deploying from an existing
ostree commit in a repo.
2023-10-06 15:55:26 +02:00
Colin Walters
2972949d13 tests/ostree-container: Drop hardcoded max layers
This should just defer to rpm-ostree.
xref https://github.com/coreos/rpm-ostree/issues/4530

(If someone cares about reproducibility here, they can specify it;
 alternatively and more reliably, they can create builder container
 images and pin to those)
2023-08-29 10:56:49 +02:00
Ondřej Budai
b94048dfd4 mounts/org.osbuild.btrfs: add support for compression
Also, add it to the sample manifest.
2023-08-25 12:35:56 +02:00
Ondřej Budai
3bbded4607 org.osbuild.mkfs.btrfs: add support for -m argument
Osbuild doesn't support creating btrfs over multiple devices, thus it should
be fine to have only single and dup in the schema (other options are for raid)
2023-08-25 12:35:56 +02:00
Ondřej Budai
dae3f884bc samples/fedora-boot-btrfs: convert to use subvolumes
We now have a full support for subvolumes in osbuild, let's use
it in the sample.

Co-authored-by: Christian Kellner <christian@kellner.me>
2023-08-25 12:35:56 +02:00
Ondřej Budai
f145a877f6 test/data: include bootable fedora image with btrfs
So we have a quick reference how to work with btrfs-based images.

Co-authored-by: Christian Kellner <christian@kellner.me>
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-08-25 12:35:56 +02:00
Ondřej Budai
c47850b8ae manifests/fedora-ostree-native-container: bump max_layers to 4
rpm-ostree crashes when max_layers is set to <4. Work around that
by bumping the max_layers argument.

See https://github.com/coreos/rpm-ostree/issues/4530
2023-08-08 12:41:17 +02:00
Ondřej Budai
6e254c95af stages/ostree.encapsulate: use new entrypoint on rpm-ostree >=2023.2
rpm-ostree 2023.2 dropped the `rpm-ostree container-encapsulate` entrypoint.
Instead, we have to use `rpm-ostree compose container-encapsulate`.

Adjust the code that it selects the correct entrypoint based on the rpm-ostree
version.

Since the new stage now requires python-yaml, add it to the buildroot and
regenerate all manifests.
2023-08-08 12:41:17 +02:00
Ondřej Budai
fbe6e3ed97 manifests: remove no longer needed f34-build-v2
It's just no longer required by anything, yay!
2023-08-08 12:41:17 +02:00
Ondřej Budai
59edb5ea6c test/data/stages: update to the new structure
This commit changes these manifests to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.

Note that this is currently limited only to stage tests that already use v2
manifests. v1 manifests will come later.

Notes:
The buildroot needs additional packages: zstd and openscap-utils. Thus,
all manifests had to be regenerated.

GPG keys were added where missing.

The oscap.remediation stage now creates a bunch of files with timestamps in
their names under /var/lib/authselect/backups. Thus, the newly introduced
`added_directories` directive is used to handle them.

I reviewed all changes in `diff.json` files, and they all seem sane given
that we jumped 4 releases forward.
2023-08-08 12:41:17 +02:00
Ondřej Budai
f0c5dfb3a3 manifests/fedora-ostree-tarball: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.
2023-08-08 12:41:17 +02:00
Ondřej Budai
111fc97035 manifests/fedora-ostree-container: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.

We are also able to remove the container manifests from the Makefile,
because they are no longer depending on the old f34-build-v2.json.
2023-08-08 12:41:17 +02:00
Ondřej Budai
9a9834a309 manifests/fedora-ostree-bootiso*: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.

An auto-generated ostree ref and isolabel was added to fedora-vars.

smc-meera-fonts was retired, so this commit changes it to rit-meera-new-fonts.
See
a8fe0d2620

icfg and reiserfs-utils are gone too, and they don't seem to be neccessary for
the image, so they were removed as well. Please correct me, if I am wrong.
2023-08-08 12:41:17 +02:00
Ondřej Budai
aeec48619b manifests/fedora-container: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.
2023-08-08 12:41:17 +02:00
Ondřej Budai
82b7053983 manifests/fedora-vars: update to fedora 38
What? I can just edit variables in one files and all(*) manifests get updated
content? That's impressive.

(*) We will be able to do all once we migrate all to the new format. For now,
    the usual disclaimer applies:

    This change is applied only to manifests based on fedora-build-v2 for now.
2023-08-08 12:41:17 +02:00
Ondřej Budai
baca25f7cb manifests: fix module_platform_id
module_platform_id has a format of `platform:f34`. I have no idea why just
`f34` is used. Let's fix it.

This change is applied only to manifests based on fedora-build-v2 for now.
2023-08-08 12:41:17 +02:00
Ondřej Budai
ed16da70eb manifests: factor repositories and gpg keys out
They are the same everywhere, we can just factor them out and save some bytes.

This change is applied only to manifests based on fedora-build-v2 for now.
2023-08-08 12:41:17 +02:00
Ondřej Budai
9286515821 manifests: move vars to a separate file
This change is applied only to manifests based on fedora-build-v2 for now.
2023-08-08 12:41:17 +02:00
Ondřej Budai
64cc289bf7 manifests: remove vars from fedora-build-v2
Defining variables in the build pipeline is potentially dangerous, because
it can lead to the buildroot using a different package set than the other
pipelines.

Thus, this commit removes the variables from the build manifest. Since now on,
the variables must be defined before the build manifest is included.

Since the build manifest is no longer buildable on its own, let's remove it
from mpp.yaml to ipp.yaml. This is a convention set by the automotive team:
ipp manifests are not meant to be directly buildable, they are only useful
for embedding.
2023-08-08 12:41:17 +02:00
Ondřej Budai
f777eb5ac2 convert all mpp.yaml files to proper YAML
This is the second step of the conversion. All mpp.yaml json files were loaded
and dumped again with pyyaml. It was tweaked to keep the order of keys and to
save multi-line strings in the "flow" style. This was done, so the GPG keys
are kept on one line. Otherwise, they take up too much visual space.

There is no functional change in this commit.
2023-08-08 12:41:17 +02:00
Ondřej Budai
d827be2fb2 rename all .mpp.json files to .mpp.yaml
osbuild-mpp supports yaml files. The advantage of yaml is that it's less
verbose and allows comments. This way, we can start documenting all the
test manifests in this repository.

This is the first step: This commit just renames the files, so we keep the
history intact. Remember: YAML is a super-set(*) of JSON, so this is fine.

There is no functional change in this commit.

(*) There are some caveats, but we don't need to care in this case.
2023-08-08 12:41:17 +02:00
Ondřej Budai
2d23f9c17c samples: remove empty el8-ostree-bootiso.json
No idea why this is here.
2023-08-08 12:41:17 +02:00
Gianluca Zuccarelli
74eed6a33b stages: add openscap autotailor stage
Add a new stage to generate an OpenSCAP tailoring file. The stage
overrides a base OpenSCAP profile by enabling and disabling user
selected rules and creates a new profile name which can be used for
OpenSCAP scanning and remediation.
2023-07-18 15:29:13 -07:00
Ondřej Budai
4439297cc4 test/data: introduce UKI also for CentOS Stream
This is a straightforward port of the UKI from Fedora to CentOS Stream.
Changes:

- Packages that does not exist in CS9 were removed:
  - shim-ia32
  - grub2-efi-ia32-cdboot
  - btrfs-progs
- Squashfs compression was changed from lz4 to gzip, because lz4 for squashfs
  isn't enabled in RHEL 9 kernel
2023-07-18 11:30:09 +02:00
Antonio Murdaca
4bfd646b0d stages: add new zstd stage
typo fix test/data/stages/README.md
add updated test-data after adding zstd to fedora-34-build-v2.mpp.json

Signed-off-by: Sarita Mahajan <sarmahaj@redhat.com>
2023-06-14 09:44:00 +02:00
Christian Kellner
1d193008d4 test/data: set source epoch for certain pipelines
For selected pipelines, set the source epoch. The date is set to
the current updates snapshot date (in epoch).
2022-12-15 13:10:35 +00:00
Christian Kellner
acc54c5202 test/ostree-image: +fedora-ostree-native-container
Test building the new fedora-ostree-native-container manifest.
2022-12-15 11:13:19 +01:00
Christian Kellner
48a4419705 test/data: persist the journal for ostree images
Include the new journald config stage to configure journald to
persist the journal. This is needed since we don't create the
`/var/log/journal` directory that journald uses to switch the
default to persistent storage. But instead of creating that
directory, we explicitly configure journald via the new stage.
This is also what Fedora CoreOS does.
2022-11-16 17:51:56 +01:00
Christian Kellner
638d5b834d test/data: add 'rw' kernel flag to ostree image
A recent commit (8a7b6d3) fixed the ostree config stage and thus
we actually properly set the readonly flag for the deployment.
This broke the image since we did not specify the `rw` kernel flag
and as a consequence the ostree mounting code in the initrd broke.
2022-11-16 17:51:56 +01:00
Christian Kellner
ed67839183 test/data: add rootfs to UKI
Create a squashfs image from the root file system and append it
to the existing initram fs. Passing `root=live:/rootfs.img`
is enough to use the existing dmsquash machiner in dracut.
2022-11-14 20:10:59 +01:00
Christian Kellner
053f027c67 test/data: add UKI test manifest
Example UKI manifest.
2022-11-14 20:10:59 +01:00