Commit graph

1704 commits

Author SHA1 Message Date
Ondřej Budai
d8d161480e rhel86/90: change isolevel of image-installer to 3
So it can contain payload bigger than 4GiB.

Related: rhbz#2056451
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-02-24 17:56:22 +00:00
Antonio Murdaca
522ef73f4c internal/{8,9}: add clevis deps to simplified installer
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-24 17:07:34 +01:00
Antonio Murdaca
74540bcee7 distro/rhel90: add fido dracut module and enable customizing onboarding
FDO secure device onboarding support for RHEL90.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-24 17:07:34 +01:00
Antonio Murdaca
e2bd3506e2 distro/rhel86: add fido dracut module and enable customizing onboarding
This patch also introduces customizations to fully enable onboarding
options for FDO.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-24 17:07:34 +01:00
Christian Kellner
892cfb67cc osbuild2: add new FDOStage for org.osbuild.fdo
The stage takes no options but a single file input that contains the
root certs.
Add the stage with a helper constructor that will generate the needed
reference based on the actual certificate data.
Add corresponding tests.
2022-02-24 17:07:34 +01:00
Christian Kellner
6d383ec89a osbuild2: add org.osbuild.inline source
Add support for the `org.osbuild.inline` source via a new `InlineSource`
and the corresponding `InlineSourceItem`. A utility function `AddItem`
can be used to conveniently add items based on data (as strings).
2022-02-24 17:07:34 +01:00
Achilleas Koutsou
f71b4f69a8 distro/rhel86: remove greenboot condition for CS8
greenboot-default-health-checks is available in CS8 as well now.
2022-02-24 17:07:34 +01:00
Achilleas Koutsou
be0a45fe83 distro/rhel86: sort -u anaconda package set 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
c4d6fcbe5b distro/rhel90: add lldpad and fcoe-utils to anaconda packages
Required by dracut modules.
2022-02-24 16:30:04 +01:00
Achilleas Koutsou
cae6a8d2b1 distro/rhel86: add lldpad to anaconda packages
Required by dracut modules.
2022-02-24 16:30:04 +01:00
Achilleas Koutsou
1762336891 distro/rhel86+90: add imageInstaller to aarch64 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
07705aea7a distro/rhel90: split out arch-specific packages for anaconda 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
82bec696b2 distro/rhel86+90: pipeline function rename 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
9a8271a524 distro/rhel86+90: variable rename
Reflect the external name of the image type for clarity.
2022-02-24 16:30:04 +01:00
Gianluca Zuccarelli
62c44e86f9 disk: ensure minimum size for filesystems
This commit fixes #2347 by ensuring that a minimum
size of 1GB is set for all file systems. The only
exception to this is the `/usr` which is set to 2GB,
since this was the only mountpoint that was previously
being checked.
2022-02-24 11:00:35 +01:00
Gianluca Zuccarelli
4d83ae9878 distro/rhel86,rhel90: add /tmp mountpoint
The `/tmp` mountpoint was mistakenly left out
of the allowlist for previous distros. This
commit enables the ability to create the
`/tmp` filesystem for the rhel86 & rhel90
distros.
2022-02-24 11:00:35 +01:00
Achilleas Koutsou
91d9417f5a distro/rhel90: use new unified grub2 stage options
With the new grub2 stage options we have the following changes to the
grub2 stage:
- Set the WriteCmdLine flag to false to not write kernel command line
  options to grubenv.
- Don't set the kernel command line options in the stage options.

The kernel command line options are now only specified in the Kernel
command line stage (org.osbuild.kernel-cmdline) so we add all options
there:
- Image type options
- Blueprint options
- Partition-table-specific options

Updated manifests and image info.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-23 22:42:59 +01:00
Achilleas Koutsou
83ce9aa4ef grub2: new grub2 stage options constructor for Unified configs
New constructor for unified grub2 setups [0].  Having this separate
constructor lets us have different logic for unified and non-unified
cases and also have fewer function parameters.

[0] https://fedoraproject.org/wiki/Changes/UnifyGrubConfig

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-23 22:42:59 +01:00
Achilleas Koutsou
a7c702c4ae osbuild2: remove redundant option set condition
The Legacy stage option is always set to the value from the function
argument unconditionally.  This condition is useless.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-23 22:42:59 +01:00
Sanne Raymaekers
e9daacd1dd internal/cloudapi: Allow bp.Customizations being nil
Customizations being nil isn't the same as an empty object. The
edge-installer types require customizations equalling nil.

This partially reverts bb486bcccb.
2022-02-23 11:24:27 +00:00
Achilleas Koutsou
129536dad0 distro/rhel86,rhel90: don't write keys for ostree commits in user stage
Writing the key to the user home directory has no effect for ostree
commits.  Instead we write them using a fist-boot service.
In certain situations (e.g., when building an upgrade commit against an
existing parent), the user's home directory might not exist during the
build and the user key creation fails in the users stage, so let's
remove it entirely to avoid the issue.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
459a07d101 cloudapi/v2: update tests to match new ostree parameter rules
- Create test servers that serve a commit ref for ostree compose
  requests.
- Adapt test cases t new rules.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
3839a7d0dc cloudapi/v2: catch ParameterComboError from ostree param validation 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
9e0af86775 ostree: rename errors and introduce ParameterComboError
Shorter and clearer error types.
- InvalidParameterError is now RefError.  It is returned when a ref (the
  new ref or the parent ref) is invalid.
- The ResolveRefError is not renamed.  It is returned when a ref can't
  be resolved (e.g., ref not found at URL).

New error type ParameterComboError.  It is returned when a parent ref is
specified but no URL, which is an invalid parameter combination.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
36d8cd1dd2 ostree: move test server to separate package
Make it reusable for other packages
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
ef513329a1 weldr: update tests to match new ostree parameter rules
- Create test servers that serve a commit ref for ostree compose
  requests.
- Adapt test cases to new rules.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
6e42ff7b44 weldr: reformat Compose test cases
Easier to read and modify if the structs are broken up.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
135cd684fc ostree: new ostree parameter rules
All parameters can now be specified at the same time.
See https://github.com/osbuild/osbuild-composer/issues/2131 for a
description of how the parameters are meant to interact.

In brief, the only invalid parameter combination is specifying a Parent
without a URL.
All other error conditions are for malformed URLs, invalid characters in
a ref, or error responses from the server.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
134a84ac23 cloudapi/v2: test ostree url + parent error conditions
Supplying both a URL and a parent ID (regardless of ref) is currently an
error, just like in the existing Weldr API.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
bfaf0c073b cloudapi/v2: support specifying parent ref for ostree requests 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
24b70837c1 cloudapi/v2: validate ostree params using common validation function
Use the ostree package error types to keep the existing distinction
between Ref- and URL-related errors.
Introduce a new error condition for a general InvalidOSTreeParams
failure.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
c68850fa26 ostree: return cusotm errors from validation functions
Errors implement the error interface, so we can return them as generic
errors. Callers can test the type only if they want to determine the
failure type.

The error types that can be returned from each function are documented
in the docstring.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
30e127d1b6 ostree: custom errors for ostree parameter validation 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
7f69d56fc9 ostree: simplify VerifyRef() function
Return value of condition immediately
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
923850ff1b cloudapi/v2: test ostree params and error conditions 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
f885de4c68 distro: remove OSTreeImageOptions type and use ostree.RequestParams 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
102c322ec9 ostree: simplify ResolveParams arguments
No need to pass the entire image type. We just need the default ref.
This removes the distro package dependency from the ostree package,
which we will need so distro can use the ostree types and functions.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
b92754b135 ostree: rename request parameters type
It's in the ostree package, so it doesn't need to have OSTree in the
name.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
db345d75dd ostree: include ref in error message when invalid 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
417d913439 weldr: use new ResolveOSTreeParams function 2022-02-23 11:08:24 +01:00
Achilleas Koutsou
c60c54aa43 ostree: ostree parameter validation and resolve function
Validates the ostree parameters and resolves the parent ID.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
4d31c8e69d weldr: change all OSTree related error IDs to OSTreeOptionsError
These will all be reported from the same validation function.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
26468315ab weldr: expand ostree parameter test cases
Adding three more combinations that weren't covered by previous tests:
- Supplying ref, parent, and URL: should result in an error
- Supplying ref and parent: OK
- Supplying parent, and URL: same as first case (ref gets default value
  from image type)

Added default OSTreeRef() to test image type to cover the cases where
the ref isn't specified but affects the validation.

Separated and commented the test cases.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
01b2b15ebc weldr: reuse api for all test cases in TestCompose 2022-02-23 11:08:24 +01:00
Christian Kellner
34924c7af4 distro: use new GenImageKernelOptions in ostreeDeployPipeline
The new `GenImageKernelOptions` will retrun all needed kernel options
that are derived from the partition table. The only case - for now -
is if the partition table contains a LUKS decice, where the uuid of it
needs to be passed to the on the kernel command line so that it will
get unlocked.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
2c6e726c94 disk: add new GenImageKernelOptions helper
This creates the needed kernel options for an image, if any,
based on the partition table.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
54a4616a7d distro: remove unused sfdiskStageOptions
This was replaced by the previous switch to `GenImage*Stages`.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
4a8cf5e4c4 distro: switch liveImagePipelines to use GenImage*Stages
Use the new `GenImage{Prepare,Finish}Stages` in all liveImagePipelines
methods. This should allow us to handle partition tables with LUKS2 and
LVM2 transparently. Since none of the existing layouts contain any of
those, nothing should currently change.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
85e2a53606 osbuild2: add new GenImage{Prepare,Finish}Stages
Add new helper functions that will return the necessary stages to
prepare a disk image, i.e. take care of creating the raw image
file, partitioning it, creating the devices on it (LUKS2, LVM2),
and formatting all the file systems: `GenImageStagesPrepare`.
Additionally, some partition layouts require some post-processing,
e.g. LVM2 where the volume group needs to be renamed "offline".
For this the `GenImageFinishStages` was added.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
670b936e6b osbuild2: new GenDeviceFinishStages method
This should be called at the end of the pipeline that creates an
image, to add stages that are needed to finish up the image.
Currently the only stage that will be added is the `lvm2.metadata`
stage in the case the partition layout contains LVM2.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00