Commit graph

147 commits

Author SHA1 Message Date
Achilleas Koutsou
fe514b9c2e test: create new test cases (manifests)
New test cases for edge- and image-installer with users.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
2eef6e6e2d osbuild2: deduplicate groupStageOptions()
Use single NewGroupsStageOptions() from osbuild2 instead of implementing
in each distro.

The new function does not set the Group.Name field anymore.  The field
does not exist in the osbuild schema and was silently ignored.
The field in the stage has been marked 'omitempty' and the relevant
manifests have been updated.
2022-03-28 14:08:57 +02:00
Tomas Hozza
2ec55b4c53 RHEL-90: use XBOOTLDR partition GUID for /boot
Use the Extended Bootloader Partition GUID for `/boot`, instead of the
Linux filesystem data GUID. This is useful for autodetection of a
partition purpose based on its GUID without reading the `/etc/fstab`
first.

Ensure that when creating mountpoints, e.g. when converting the
partitions layout to LVM, the `/boot` partition get the proper GUID
assigned.

Regenerate RHEL-90 and centos-9 image test cases.

Related to https://bugzilla.redhat.com/show_bug.cgi?id=2057231
2022-03-24 15:40:10 +01:00
Tomas Hozza
60db6ad06f image tests: update GPG keys used for RHEL-9.0 repos
SHA-1 key is no longer supported, update it with a new one from
redhat-release.

Related rhbz#2058497

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-03-23 13:22:13 +01:00
Antonio Murdaca
b2d18166de test/data/manifests: regenerate
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-14 17:31:40 +01:00
Christian Kellner
923a627de4 distro/rhel86: set GPGKeyFiles for azure-rhui
Import the appropriate GPG keys for Red Hat contained in the package
`redhat-release` and Microsoft contained in `rhui-azure-rhel8`.
2022-03-05 21:04:24 +01:00
Christian Kellner
5b802f699a distro/rhel86: sync packages for azure-rhui
Sync the list of packages with the existing market place images.
2022-03-05 21:04:24 +01:00
Christian Kellner
320dcb0f9d distro/rhel86: update sysconfig options
Set `kernel-core` to be the defaul kernel instead of `kernel`.
2022-03-05 21:04:24 +01:00
Christian Kellner
e60517f0af distro/rhel86: remove authconfig call from azure-rhui
authconfig is actually a RHEL 7 thing and we should not call it for
RHEL 8.
2022-03-05 21:04:24 +01:00
Antonio Murdaca
c1a896dd1d rhel{86,90}: define simplified installer build packages set
The edge installer and edge simplified installer build roots have
diverged, i.e. the latter need clevis/luks, so define a new pkg
set for the simplified installer extending the edge installer one.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-28 23:05:45 +00:00
Tom Gundersen
973b5141b3 ditro/rhel86: set volid like in rhel9.0
This is only required in RHEL9.0, but best practice is to always pin these things
down. Also increases uniformity between distros.

Simplify a bit the volid generator by making it require `rand.Rand` rather than
`io.Reader`, and hence eliminating the need for error handling.
2022-02-28 23:05:45 +00:00
Achilleas Koutsou
154e966cda test: update manifests and image info
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-28 23:05:45 +00:00
Christian Kellner
9e5b265a58 osbuild2: lock loopback devices during sfdisk, mkfs
Since udev will probe block devices it is advisable to hold a lock
on the device when modifying its partition table or the superblock
of the filesystem (see [1]). osbuild loopback devices do support
this via the `lock` option. Set this option for all operation that
involve changing block device "metadata" that could potentionally
race with udev, such as sfdisk, mkfs, creating a luks2 container
and creating LVM2 volume groups and logical volumes.
NB: osbuild also has its own device inhibition logic to prevent
udev/lvm2 from auto activating devices and in general to limit the
interaction between the host and devices used by osbuild. See [2]
for more information.
NB: this also locks the loopback device in situation where we the
it is strickly not the right thing to do, e.g. when creating a fs
on a logical voume that is located on a loopback device, since in
this case the device we would need to lock is the logical volume.
Sadly, LVM/DM devices are exempt from block device locking. But,
due to a bug in osbuild < 50, the udev inhibitor does *not* work
for loopback devices and therefore we have to use the actual lock
to preven LVM device auto-activation via `69-dm-lvm-metad.rules`.
The change was implemented by adding a new boolean to `getDevices`
indicating if the loopback device should be locked or not. Once
we depend on osbuild 50 we can change the logic in `getDevices`
to only lock the loopback device if the number of devices is one,
i.e. we are working directly on the loopback device.

[1] https://systemd.io/BLOCK_DEVICE_LOCKING/
[2] /usr/lib/udev/rules.d/10-osbuild-inhibitor.rules
2022-02-28 17:09:30 +01:00
Christian Kellner
19e7890f63 rhel90: automatically convert to LVM on fs customizations
Whenever we create a new mountpoint due to a user customization,
ensure the layout uses LVM, i.e. convert plain layouts to it, if
needed. This does not apply to rpm-ostree based systems, e.g. the
simplified installer since they will be using LUKS in 9.0.
Add "lvm2" to the build pipeline and thus generate new manifests
and image infos.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-28 17:09:30 +01:00
Christian Kellner
f91d8c6292 distro/rhel86: add support for azure marketplace
Add support for building images for the Azure marketplace: add a
new image type "azure-rhui" that can be used to build images
tailored to the Azure marketplace.
Add two sample manifests for 8.5 and 8.6, but note that even the
8.5 is using the 8.6 distro definitions. Also no image-info is
included since `image-info` cannot (yet) handle LVM setups and
the azure marketplace images use the LVM setup.
2022-02-27 22:03:36 +01:00
Achilleas Koutsou
41e4b17f89 distro/rhel86: add lvm2 to base build package set
We want to support LVM on all image types (optionally) so let's make
lvm2 available in all build roots.

Manifests and image info updated for RHEL 8.6 and CentOS Stream 8.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-27 13:04:55 +01:00
Achilleas Koutsou
a7fbe916b7 distro/rhel86+90: set selinux in permissive mode in installers
SELinux in the installer environment is in permissive mode in regular
installation ISOs
2022-02-26 15:55:56 +00:00
Achilleas Koutsou
365d754827 test: add new manifests for edge installers
Edge installer manifests (both simplified and anaconda) added for RHEL
8.6, RHEL 9.0, CS8, and CS9 for both supported architectures.
2022-02-26 15:55:56 +00:00
Tomas Hozza
ccd0be8c34 RHEL-90: use C.UTF-8 for images that only have glibc-minimal-langpack
Change the default locale to `C.UTF-8` for RHEL-9.0.
For all the images which install `langpack-en`, keep using the
`en_US.UTF-8` locale. `C.UTF-8` is used as the default for:
 - edge-commit
 - edge-container
 - image-installer
 - qcow2
 - tar

Also change the default locale for the edge-simplified-installer
installer-tree pipeline, since its package set contains only
`glibc-minimal-langpack`.

Regenerate RHEL-90 and c9s image tests.

Fix #2206

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-26 11:29:35 +01:00
Tom Gundersen
5f894281d5 test/manifest/image-installer: fix conflicting merge
The new image-installer tests were merged at the same time as the isolevel support. Adjust the test cases.
2022-02-24 18:53:21 +00:00
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
Achilleas Koutsou
7f17757122 test: update manifests and image info
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-24 17:07:34 +01:00
Achilleas Koutsou
4ff0916caa test: update CS8 manifests and image info 2022-02-24 17:07:34 +01:00
Achilleas Koutsou
fa209fe747 test: generate aarch64 image installer manifests
Added to imagetype map for test case generators and generate new
manifests.
2022-02-24 16:30:04 +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
602111dedd osbuild2: generalise copy stage option generation
Use entity based method `ForEachMountable` and `getDevices` to generate
all mounts and devices in a generic way, which then allows for mounts on
arbitrarily nested devices.

Update manifests and image info:
- New device names generated by `pathdot()` to avoid basename
  collisions.
- Some partitions are generated in a different order now which changes
  the order they appear in the manifest and their UUIDs.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Christian Kellner
b7abef54e8 disk: calculate padding for secondary GPT header
Instead of hard coding a padding of 100 sectors for all layouts, i.e.
MBR and GTP, adjust the needed space depending on the layout: for MBR 
we don't need to reserve any space at all since it does not have a 
secondary header. For GTP we reserve 33 sectors, as indicated in the
UEFI specific, which allows for the header itself and up to 128 entries.
To not modify the layout of already released distributions, like RHEL
8.4 and 8.5, a new member called `ExtraPadding` is added to `Partition
Table` and then used in the corresponding layouts to preserve the
existing padding of 100.
2022-02-22 19:23:41 +00:00
Christian Kellner
d9ef268809 disk: use GenerateUUIDs in CreatePartitionTable
Instead of generating the UUIDs directly when new partitions are
created and separately for the boot and root partition, use the
new `PartitionTable.GenerateUUIDs` method to generate all UUIDs
that are missing in one go. Since this changes the order in
which the uuids are generated the test manifests UUIDs changed
and needed to be updated:
I used to following patch to get the updated manifests:

--- a/internal/distro/distro_test_common/distro_test_common.go
+++ b/internal/distro/distro_test_common/distro_test_common.go
@@ -105,6 +105,12 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
                                require.NoError(t, err)

                                diff := cmp.Diff(expected, actual)
+                               if diff != "" {
+                                       tt.Manifest = got
+                                       data, _ := json.MarshalIndent(tt, "", "  ")
+                                       path := filepath.Join("/tmp", filepath.Base(fileName))
+                                       _ = ioutil.WriteFile(path, data, 0644)
+                               }
                                require.Emptyf(t, diff, "Distro: %s\nArch: %s\nImage type: %s\nTest case file: %s\n", d.Name(), arch.Name(), imageType.Name(), fileName)
                        }
                })

And the following fish snippet to update the existing ones, using the
jq and sponge utilities:

for file in /tmp/rhel_85-*.json
  set filename (basename $file)
  jq -s '.[0].manifest = .[1].manifest | .[0]' test/data/manifests/$filename /tmp/$filename | sponge test/data/manifests/$filename
end
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
22f23ec38e test: update manifests and image info 2022-02-18 10:39:08 +00:00
Achilleas Koutsou
1b0b54f853 test: regenerate RHEL 8.6 and 9.0 manifests
Repositories were update for the two distros so we've regenerated all
the manifests.
2022-02-16 10:49:55 +01:00
Tomas Hozza
1273ef7b35 Regenerate all image test cases with the enhanced image-info
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-15 15:56:56 +01:00
Tomas Hozza
ece6452e2a Use the latest RPMRepo snapshot for RHEL-9.0 image tests
This is needed to satisfy RPM dependencies of GCP guest tools, which
will be installed on the `gce` image type.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-14 12:39:12 +01:00
Tomas Hozza
f43d9f4744 Add missing F34 and F35 image test cases
Add F34 and F35 image test cases for all remaining image types, which
were previously not tested. With this PR, image test cases are now
generated for all image types on all architectures as supported by the
Fedora distro definition.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-09 15:29:33 +01:00
Tomas Hozza
1401a7a659 test: add image test cases for Fedora 34 and 35
Delete Fedora 33 image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-08 10:19:52 +01:00
Tomas Hozza
91097fa007 test: regenerate RHEL 8.5 and 8.6 EC2 image test cases
Fix missing missing `image-info` report updates after PR#2235.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-07 20:33:54 +01:00
Tomas Hozza
eb36b86161 RHEL-90: Remove deprecated crashkernel=auto option
Setting of the `crashkernel` option to the appropriate value is now done
by the `kexec-tools` package when installed and when any new kernel is
installed.

Regenerate relevant image test cases.

Fix #1819
Fix rhbz#2006692

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-07 09:29:07 +01:00
Christian Kellner
9302befa67 distro/rhel90: disable pw auth for EC2 images
Disable loging in via password authentication since this is an
official Amazon marketplace requirement

  Linux-based AMIs must not allow SSH password authentication.
  Disable password authentication via your sshd_config file by
  setting PasswordAuthentication to NO.

  Section "Security policies" from
  https://docs.aws.amazon.com/marketplace/latest/userguide/product-and-ami-policies.html
2022-02-03 14:57:16 +01:00
Christian Kellner
90cebf0337 distro/rhel86: disable pw auth for EC2 images
Disable loging in via password authentication since this is an
official Amazon marketplace requirement

  Linux-based AMIs must not allow SSH password authentication.
  Disable password authentication via your sshd_config file by
  setting PasswordAuthentication to NO.

  Section "Security policies" from
  https://docs.aws.amazon.com/marketplace/latest/userguide/product-and-ami-policies.html
2022-02-03 14:57:16 +01:00
Christian Kellner
8aede24057 distro/rhel85: disable pw auth for EC2 images
Disable loging in via password authentication since this is an
official Amazon marketplace requirement

  Linux-based AMIs must not allow SSH password authentication.
  Disable password authentication via your sshd_config file by
  setting PasswordAuthentication to NO.

  Section "Security policies" from
  https://docs.aws.amazon.com/marketplace/latest/userguide/product-and-ami-policies.html
2022-02-03 14:57:16 +01:00
Tomas Hozza
8b8c7bbbbe Fix FS label of the ESP in Fedora distro definition
The QEMU assembler in Fedora distro definition for UEFI systems used
longer than allowed label for the VFAT filesystem of the EFI System
Partition. The maximum allowed label length is 11 characters.

This worked before with dosfstools, but in 2018, they added a label
validation [1]. This change got into the v4.2 release of dosfstools,
released in Jan 2021. And subsequently since F34, this new version of
dosfstools is present in Fedora repositories.

[1] ca54953476

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-03 14:51:07 +01:00
Achilleas Koutsou
22b923dee3 test: regenerate RHEL 9.0 installer test manifest 2022-02-01 19:27:47 +01:00
Christian Kellner
669d3e0734 distro/rhel86: fix ec2 boot partition for arm64
It should be `1048576` (exactly 512 MiB), like it is for all other
distributions. It somehow got mingled in when the distribution was
forked off from 8.5/9.0 beta (1048676 to 1048576 strongly suggests
a sed command was involved, so we blame that).
2022-01-31 11:46:09 +01:00
Christian Kellner
c5feb93279 distro/rhel90: no uuids in dos partition table
The unification of the partition table also introduced uuids and
types in uuid form for partition tables in dos layout, sill used
on PPC64LE and s390x. The org.osbuild.sfdisk stage did work with
that but produced a `/boot` partition with the wrong type, which
grub2 refused to read from and thus prevented boot. Fix this by
removing uuids from the dos partition tables.

Reported-by: Jakub Rusz <jrusz@redhat.com>
2022-01-28 12:16:39 +01:00
Tomas Hozza
ec6099f7f6 RHEL-86: port over the RHEL-90 pipeline refactoring
Port all of the pipeline refactoring done to RHEL-90 to RHEL-86. Both
distros now use the same approach.

Regenerate all RHEL-8.6 and CentOS 8 image test cases.

[1] https://git.centos.org/centos/kickstarts/tree/master

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-01-11 17:08:19 +01:00
Tomas Hozza
960aad0b0a RHEL-86: apply subscriptions and RHSM configuration only on RHEL
RHSM configuration is now applied conditionally only on RHEL. The same
applies to the customization to subscribe the system on first boot.

The reason is that the CentOS `@core` package group does not contain
`subscription-manager`. Thus it is not installed on CentOS Stream by
default and also CentOS 8 image definitions don't apply any changes
to the RHSM configuration [1].

In addition, make sure to not install any subscription-manager
packages on CentOS Stream images.

Regenerate all CentOS 8 image test cases.

[1] https://git.centos.org/centos/kickstarts/tree/master

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-01-11 17:08:19 +01:00
Tomas Hozza
43ea54f8de RHEL-90: replace ec2X86_64BaseTreePipeline by osPipeline
Move the x86_64 specific configuration from `ec2X86_64BaseTreePipeline`
to x86_64-specific image configurations for EC2 / AMI images. As a
result, remove the `ec2X86_64BaseTreePipeline` entirely and replace it
with `osPipeline`.

Regenerate image test cases. While there are changed in the manifests,
the actual image configuration didn't change at all and thus the
`image-info` report was not changed.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-01-11 17:08:19 +01:00
Tomas Hozza
8130c892f0 RHEL-90: move RHSM configuration to ImageConfig structure
Move the RHSM configuration settings to `ImageConfig` structure and use
when handling subscriptions in `osPipeline`, `ec2BaseTreePipeline` and
`ostreeTreePipeline` functions.

Regenerate image test cases. While there are changed in the manifests,
the actual image configuration didn't change at all and thus the
`image-info` report was not changed.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-01-11 17:08:19 +01:00
Tomas Hozza
b200fa8fcd RHEL-90: introduce default image config data structure
Introduce a new data structure `ImageConfig` holding the default OS
configuration applied when building an image. The structure can be used
to hold the default image configuration on the distribution level with
possible overrides defined on the image-type level.

As a starting point, move hard-coded default values and configuration
common for `osPipeline`, `ec2BaseTreePipeline` and `ostreeTreePipeline`
to the distribution and image-type default image configuration. This is
preparing the ground for merging all of these three pipeline functions
into `osPipeline`, which will produce the appropriate OS pipeline based
on the image-type configuration and the fact if it is rpmOstree or not.

Regenerate affected EC2 and AMI manifests. There is however no change in
the resulting image configuration and image-info report.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-01-11 17:08:19 +01:00
Tomas Hozza
a5319e78d4 (re)generate image test cases for image-installer on all distros
The existing test cases for `image-installer` image type were not
regenerated as part of PR #2135 which introduced 'image_type_tags'
because regenerating them using `generate-all-test-cases` failed on them
due to trying to analyze them using 'image-info'. These test cases were
most probably originally generated manually with --keep-image-info
option passed to `generate-test-cases`. And I missed that their
regeneration failed at that time.

Add the `image-installer` image type to all distros in
`distro-arch-imagetype-map.json` and (re)generate the test cases for it.

The image test case for CentOS Stream 9 is not generated, because there
are no repos defined yet for the distro. This is part of the CentOS 9
PR #2142.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-21 09:59:17 +01:00
Tomas Hozza
33c7da9dc3 tools: use image_type_tags in repos used for image test cases
Use image_type_tags in repo definitions used for generating image test
cases. Enhance the `generate-test-cases` script to take the
image_type_tags into account when creating a compose request for a
specific image test case.

The motivation for the change is to keep the list of repositories in the
compose request of a image test case as small as possible. Previously,
all of the defined repositories were part of each image test cases for a
specific architecture, even those that were not needed.

Regenerate affected image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 18:07:50 +01:00