Commit graph

94 commits

Author SHA1 Message Date
Martin Sehnoutka
04f69db2c0 osbuild2: selinux stage - introduce force_autorelabel option
This was added in osbuild: https://github.com/osbuild/osbuild/pull/875

Introduce the same option in composer and make it optional by specifying
it as a pointer to bool value. It would work the same even if it was
there every time, but as it should be an edge case, don't use it
everywhere. Also osbuild doesn't require it to be present, so it seems
like the right thing to do.
2021-11-22 15:28:19 +01:00
Martin Sehnoutka
f4412ff07f osbuild2: update rhsm stage
The stage now allows for customizations specific to YUM or DNF. So far
it is just an alias to the same definition, meaning that composer can
use exactly the same structures for both.

Ref: https://github.com/osbuild/osbuild/pull/876
2021-11-19 10:43:58 +01:00
Achilleas Koutsou
e32f1cd697 osbuild: test Write() on nil Result receivers
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-17 15:21:40 +01:00
Achilleas Koutsou
7f8a1b314a osbuild: check if result objects are nil in Write()
Before dereferencing the method receiver in Write(), check if the object
is nil and return early.

Fixes #2002

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-17 15:21:40 +01:00
Tomas Hozza
029c005473 osbuild2/modprobe: extend and rework stage options validation
Rework the stage options data validation to be done in constructor
methods, instead of when being marshalled to JSON.

Add validation of values passed to constructor methods for modprobe
command structures.

Add validation of the configuration filename based on stage schema.

Related to issue #1785.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-11-16 21:49:38 +01:00
Tomas Hozza
801c9fadab osbuild2: support 'install' command in the modprobe stage
Add support for the 'install' modprobe command in the modprobe osbuild
stage implementation.

Extend unit tests to verify marshalling the stage options into JSON.

Related to https://github.com/osbuild/osbuild/pull/867.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-11-16 21:49:38 +01:00
Achilleas Koutsou
a0479a1bcf osbuild2: test result Write() function
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
65f1a24ecd osbuild2: remove Prints in lvm.create stage test
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
dc0e3dea92 osbuild: test result conversions
Moved and adapted tests from osbuild1 to osbuild2.
Moved test data from osbuild1 to osbuild2.
Added conversion tests for v1 to v2.
Added full v2 result raw data from successful build.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
b7bab25e73 osbuild2: check v1 data before converting
Don't convert stage results if there are none.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
e73d35d7c1 osbulid2: unmarshal PipelineMetadata into ptr receiver 2021-11-16 09:49:37 +01:00
Achilleas Koutsou
a9ea5e12a8 osbuild2: omitempty Error field in v2 Result 2021-11-16 09:49:37 +01:00
Achilleas Koutsou
5f8bd4fd6e osbuild2: small code reorganisation
Move main type to the top of the file
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
10eb0d65a1 osbuild2: convert from osbuild1 results
Convert osbuild1.Result{} to osbuild2.Result{}.
For the Metadata objects, it assumes they are directly convertible: the
stage metadata structs have the same members.

The old conversion code from v2 to v1 is removed and the equivalent
conversion logic is moved to osbuild2:
- version detection based on stub
- custom unmarshaller that calls conversion function if v1 result is
  detected

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
9eff6f1e95 osbuild2: v2 Result writer
Implementing writer for osbuild2 Result type.
Since Go maps don't have stable ordering, sorting by the pipeline name
provides stable output.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Martin Sehnoutka
a880c9c019 osbuild2: new stage yum config
This stage was introduced in osbuild 41. Add support into
osbuild-composer and a test using test data from osbuild repo.
2021-11-12 20:27:35 +01:00
Martin Sehnoutka
b159d04af7 osbuild2: new stage pwquality conf
This stage was introduced in osbuild 41. Add support into
osbuild-composer and a test using test data from osbuild repo.
2021-11-12 20:27:35 +01:00
Martin Sehnoutka
59be127daf osbuild2: new stage authconfig
This stage was introduced in osbuild 41. Add support into
osbuild-composer.
2021-11-12 20:27:35 +01:00
Martin Sehnoutka
af9cca1b50 osbuild2: new stage sshd config
This stage was introduced in osbuild 41. Add support into
osbuild-composer and a test using test data from osbuild repo.
2021-11-12 11:40:13 +01:00
Christian Kellner
f6d4228b00 osbuild2: add bootloader option to ostree.config
Expose the new (osbuild > 36) `sysroot.bootloader` option to
configure the bootloader backend for OSTree deployments.
Normally, this should be set to `none` for modern bootloader
that use the BLS, since the BLS snippets are always generated.
2021-09-27 20:10:04 +02:00
Christian Kellner
920863df70 osbuild2: small doc fix for ostree.config 2021-09-27 20:10:04 +02:00
Tomas Hozza
eef9971027 osbuild2: add support for org.osbuild.tuned stage
Add support for a new osbuild stage `org.osbuild.tuned`, for
setting TuneD profile.

Add unit tests for the new stage.

Related to https://github.com/osbuild/osbuild/pull/797.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-15 14:46:25 +02:00
Tomas Hozza
8b623d9463 osbuild2: add support for org.osbuild.dnf.config stage
Add support for a new osbuild stage `org.osbuild.dnf.config`, for
configuring DNF.

Add unit tests for the new stage.

Related to https://github.com/osbuild/osbuild/pull/798.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-15 14:46:25 +02:00
Tomas Hozza
d9610b97fc osbuild2: add support for org.osbuild.sysctld stage
Add support for a new osbuild stage `org.osbuild.sysctld`, for
creating tmpfiles.d configuration files.

Add unit tests for the new stage.

Related to https://github.com/osbuild/osbuild/pull/804.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-15 14:46:25 +02:00
Tomas Hozza
a5097b2141 osbuild2: add support for org.osbuild.pam.limits.conf stage
Add support for a new osbuild stage `org.osbuild.pam.limits.conf`, for
creating pam_limits module configuration files.

Add unit tests for the new stage.

Related to:
- https://github.com/osbuild/osbuild/pull/802
- https://github.com/osbuild/osbuild/pull/807

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-15 14:46:25 +02:00
Tomas Hozza
3f52af2adb osbuild2: add support for org.osbuild.tmpfilesd stage
Add support for a new osbuild stage `org.osbuild.tmpfilesd`, for
creating tmpfiles.d configuration files.

Add unit tests for the new stage.

Related to https://github.com/osbuild/osbuild/pull/801.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-15 14:46:25 +02:00
Tomas Hozza
fbb70c2d10 osbuild2: add support for org.osbuild.selinux.config stage
Add support for a new osbuid stage `org.osbuild.selinux.config`,
for setting the desired SELinux policy state and type on the system.

Add unit tests for the new stage.

Related to https://github.com/osbuild/osbuild/pull/799.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-15 14:46:25 +02:00
Christian Kellner
450d12fada osbuild2/grub: add greenboot option
The greenboot option, introduced in osbuild 33, enables the
feature of the same name in grub that allows rolling back
bad updates automatically.
2021-08-28 09:20:19 +02:00
Christian Kellner
6e70506903 osbuild2/copy: ctor helper with only inputs
Add a simple constructor helper function that does not have mounts
and devices but only inputs.
2021-08-28 09:20:19 +02:00
Antonio Murdaca
10e4a853bd osbuild2: ostree options for the fstab stage
osbuild, since version 30, supports the ostree deployments for the
fstab stage.

Co-Developed-by: Achilleas Koutsou <achilleas@koutsou.net>
Co-Developed-by: Christian Kellner <christian@kellner.me>
2021-08-28 09:20:19 +02:00
Achilleas Koutsou
a98be74135 osbuild2/ostree.preptree: add missing options
Add the missing options for the `org.osbuild.ostree.preptree` stage.
2021-08-28 09:20:19 +02:00
Christian Kellner
cda1884de3 osbuild2: files input is a valid copy stage input
Mark the `FilesInput` as valid input for the copy stage input so it
can be used in the constructor helper function(s).

Co-Developed-by: Achilleas Koutsou <achilleas@koutsou.net>
Co-Developed-by: Antonio Murdaca <runcom@linux.com>
2021-08-28 09:20:19 +02:00
Christian Kellner
d27596b24a osbuild2: make inputs generic for copy stage ctor
Add a level of indirection for the copy stage constructor function
in order to be able to use it with existing input types, like the
files input.

Co-Developed-by: Achilleas Koutsou <achilleas@koutsou.net>
Co-Developed-by: Antonio Murdaca <runcom@linux.com>
2021-08-28 09:20:19 +02:00
Achilleas Koutsou
2a98885953 osbuild2: OSTreeRemote → OSTreeSourceRemote
Properly name the ostree remote source struct.
2021-08-28 09:20:19 +02:00
Antonio Murdaca
4fdf4dbd01 osbuild2: add stages for raw images and grub iso
Add the new stages included in osbuild 30 that can be used to
deploy an OSTree commit as well as the grub iso stage that
is used to configure grub2 (efi) for isos.
Bump the spec file requirement accordingly.

Co-Developed-by: Achilleas Koutsou <achilleas@koutsou.net>
Co-Developed-by: Christian Kellner <christian@kellner.me>
2021-08-28 09:20:19 +02:00
Achilleas Koutsou
14b5e98be8 osbuild2/xorrisofs: make Boot section optional
Should be a pointer otherwise it creates an empty object in the manifest
which makes the stage fail.

Co-Developed-by: Christian Kellner <christian@kellner.me>
2021-08-28 09:20:19 +02:00
Achilleas Koutsou
39b0cf39d6 osbuild2: add support for LVM stages
Stage options implement a validate() method for checking values against
schema constraints.
2021-08-28 09:20:19 +02:00
Christian Kellner
f8c8f28ac8 osbuild2: new org.osbuild.ostree.passwd stage
Add support for the `org.osbuild.ostree.passwd` and with it also
support for the `org.osbuild.ostree.checkout` input.
This stage can be used to pre-load the user and groups database
from an existing commit to ensure that uids/gids are stable.
2021-08-27 12:56:54 +02:00
Achilleas Koutsou
a717a7245b osbuild2: new stages
org.osbuild.chmod: runs chmod on one or more files
org.osbuild.nginx.conf: write nginx config file

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-27 09:29:28 +02:00
Christian Kellner
22bff1df71 osbuild2/grub2: add unified option for uefi
The `uefi.unified` option indicates whether the `org.osbuild.grub2`
will use the unified grub configration scheme[1] used by Fedora 34
and thus RHEL 9.
NB: This requires osbuild version >= 32.

[1] https://fedoraproject.org/wiki/Changes/UnifyGrubConfig
2021-08-23 13:48:26 +02:00
Christian Kellner
fcace40710 osbuild2/grub2: add install option for uefi
The `uefi.install` option indicates whether the `org.osbuild.grub2`
stage will copy the efi binaries from the build root to the `/boot`
directory in the tree.

Co-Developed-by: Achilleas Koutsou <achilleas@koutsou.net>
Co-Developed-by: Antonio Murdaca <runcom@linux.com>
2021-08-23 13:48:26 +02:00
Achilleas Koutsou
745443181e osbuild2: remove stage-specific device types
Devices unlike stage options, shouldn't be stage specific.
There is only one type of device so far, the loopback device, which
is already defined as a separate type.

The top level Devices type is simply an alias to a Device map.

The mkfs stages require a single device with a specific key ("device").
These stages accept only one device in their NewStage() function for
convenience and create the Stage struct with the required key.

The zipl.inst stage requires a device labeled 'disk' as well as the rest
of the devices that correspond to each partition. The disk device is
passed to the New stage function separately and added to the Stage
devices with the required key.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-21 13:39:10 +02:00
Achilleas Koutsou
c74d13daf8 osbuild2: remove stage-specific mount types
Mounts unlike stage options, shouldn't be stage specific. We have
filesystem specific mount types, differentiated by their type string.
Mounts can define their own additional options if necessary.

The top level Mounts type is simply an alias to a Mount array.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-21 13:39:10 +02:00
Tomas Hozza
6edf4aad49 osbuild2: add prefix parameter to the fix-bls stage
The `fix-bls` stage supports a `prefix` argument, which was not
supported in composer. Specifying this argument is necessary in case the
`/boot` mountpoint is on a separate partition.

Add the `prefix` argument to the `fix-bls` stage. Amend unit tests.

The RHEL-8.5 and RHEL-9.0 `aarch64` `ec2` and `ami` images use partitioning
with `/boot` on a separate partition. Due to this, the pipeline must specify
a non-default prefix to the `fix-bls` stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-13 08:24:37 +02:00
Achilleas Koutsou
844f77f7ca distro/rhel85: add zipl.inst stage for s390x
Installs the zipl bootloader on the disk image.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-06 07:30:05 +02:00
Achilleas Koutsou
0ed4f057c2 osbuild2: zipl install stage
New stage: org.osbuild.zipl.inst

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-06 07:30:05 +02:00
Achilleas Koutsou
38e88daea6 osbuild2: Don't add nil stages
Do nothing if a nil value is passed to pipeline.AddStage().

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-06 07:30:05 +02:00
Ondřej Budai
5c9af03785 osbuild2/grub2.inst: always include location in stage options
Location property is actually required. If it's omitted from the stage
options, the stage just fails.

Also see: https://github.com/osbuild/osbuild/pull/759

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-05 13:43:17 +02:00
Tomas Hozza
a79e541cec osbuild2: fix typo in files_input.go
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-05 09:34:07 +02:00
Tomas Hozza
a2ecf46e04 osbuild2: extend chrony stage with leapsectz property
Add support for specifying the `leapsectz` property of
`org.osbuild.chrony` stage. Modify stage tests to test setting of the
value.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00