Commit graph

679 commits

Author SHA1 Message Date
Juan Abia
4c5de045ff test: add test purpose
Most test scripts don't have any documentation regarding it's purpose,
although it can be guessed by the code. There's value in adding this
small comment.

[skip-ci]
2022-03-09 22:46:25 +01:00
Jakub Rusz
05be7c4096 test/image-tests: temporarily skip azure_rhui image testing
This manifest is intended only for internal use and is currently failing
in nightly pipelines. This will be moved to a different test script in
the future, see COMPOSER-1397.
2022-03-08 13:19:34 +01:00
Ondřej Budai
2d16aeb467 tests: add an E2E test for multi-tenancy
See the comment. It's imho still very important to have this test
but its powers are limited.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
299264f178 test/koji: install podman-plugins everywhere
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
cfb756b9ba api/{cloud,worker}: used channel name based on JWT claims for new jobs
This commit implements multi-tenancy. A tenant is defined based on a value
from JWT claims. The key of this value must be specified in the configuration
file. This allows us to pick different values when using multiple SSOs.

Let me explain more in depth how this works:

Cloud API gets a new compose request. Firstly, it extracts a tenant name from
JWT claims. The considered claims are configured as an array in
cloud_api.jwt.tenant_provider_fields in composer's config file. The channel
name for all jobs belonging to this compose is created by `"org-" + tenant`.

Why is the channel prefixed by "org-"? To give us options in the future. I can
imagine the request having a channel override. This basically means that
multiple tenants can share a channel. A real use-case for this is multiple
Fedora projects sharing one pool of workers.

Why this commit adds a whole new cloud_api section to the config? Because the
current config is a mess and we should stop adding new stuff into the koji
section. As the Koji API is basically deprecated, we will need to remove it
soon nevertheless.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Jakub Rusz
ae07093404 tests/image-tests: filter out cases with ostree URL
These tests depend on external dependencies which are difficult to setup
during image-test like http ostree repository. See
https://github.com/osbuild/osbuild-composer/pull/2389#issuecomment-1060338127
for more details.
2022-03-08 09:23:05 +01:00
Xiaofeng Wang
e147e41879 test: Fix COMPOSE_URL issue and add set-env-variables.sh 2022-03-08 09:23:05 +01:00
Jakub Rusz
485fc68a98 tests/upgrade: add user choice for vdo devices check
This is a user choice that has to be picked before the upgrade or it
acts as an inhibitor.
2022-03-08 09:23:05 +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
Christian Kellner
4b53312b7c test/data/repositories: bump snapshots to 20220301
Use the latest snapshot for the not yet released versions of RHEL and
their CentOS counterparts.
2022-03-05 11:37:12 +01:00
Antonio Murdaca
c79f51942b test/cases/simpl installer: bump to use fdo 0.4.0
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-03 16:27:57 +01:00
yih
f0522e758b test: fix ansible mount point check issue when encrypted
The device file is not `/dev/vda` anymore since we are no using a LUKS2
container, so we now have to look for `/dev/mapper/luks-`.
2022-02-28 23:05:45 +00: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
Antonio Murdaca
39db7653b5 test/data/respositories: bump snapshots to 0227
Signed-off-by: Antonio Murdaca <runcom@linux.com>
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
Alexander Todorov
cf8f05b57c tests: Better implementation for ab30694
Don't remove the pre-existing mount-points from the blueprint b/c we
still need to assert on those.

Add `/tmp` and `/var/tmp` to exercise the case where mountpoints have
matching suffixes.
2022-02-26 17:53:09 +00:00
Alexander Todorov
1459531148 Revert "tests: check mountpoints with matching suffixes"
This reverts commit ab306943d4.
2022-02-26 17:53:09 +00: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
Antonio Murdaca
6a127ae1a7 ostree-simplified-installer: pin fdo-containers commit and fix selinux
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-24 17:07:34 +01:00
Achilleas Koutsou
45a2c308f7 repos: bump RHEL 8.6 test repositories 2022-02-24 17:07:34 +01: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
yih
8d5490e209 test: add test case for fdo
Add a new test case that tests secure device onboarding for the
Edge simplified installer.
2022-02-24 17:07:34 +01:00
Achilleas Koutsou
efbef95bf1 test: change condition for greenboot checks in ansible playbooks
Both CentOS versions are now part of the same condition.
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
eda78a9a99 Update CentOS Stream 8 repositories 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
Gianluca Zuccarelli
ab306943d4 tests: check mountpoints with matching suffixes
Filesystem mountpoints with matching suffixes, i.e.
`/tmp` and `/var/tmp` was causing image builds to
fail. Since this was fixed with #2141 the integration
tests have been updated to check for this.
2022-02-24 11:00:35 +01:00
Sanne Raymaekers
b05723a37e templates/composer: Verify against mass sso and rh sso 2022-02-24 09:48:12 +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
Xiaofeng Wang
05cbbf0cc5 test: Skip rollback test only on UEFI VM of ostree-rebase.sh 2022-02-23 11:08:24 +01:00
Xiaofeng Wang
45ee6c297f test: Remove ANSIBLE_STDOUT_CALLBACK=yaml in ostree-rebase.sh 2022-02-23 11:08:24 +01:00
Xiaofeng Wang
bc9d1431bc test: Add OSTree rebase test for OSTree parent ref support
To run ostree-rebase.sh, like RHEL 8.6 and RHEL 9, the CS8 VM
needs "large" flavor for more CPU and memory resource.
2022-02-23 11:08:24 +01:00
Achilleas Koutsou
be382ecef8 test/ostree: update ostree compose request to match new requirements
Specifying a parent commit ID without a URL isn't allowed now.  The
upgrade commit is built without a parent.  The OS upgrade should still
work without it.
Getting the ID of the first commit is not necessary now.
2022-02-23 11:08:24 +01:00
Alexander Todorov
646fbe93c7 Revert "tests: Conditionally enable osbuild-dnf-json-tests"
Current version is 45.

This reverts commit 966692be11.
2022-02-22 21:57:30 +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
Tom Gundersen
351d06aecf tests/cases/api.sh: make /var at least 256MB
We (mistakenly) don't enforce a minimum size for /var,
so setting it to 1024 (1kB) causes the image build to fail.

CI does not expose this in a helpful way at the moment,
so this is a bit tricky to debug.

Also skip customizations for the AWS.S3 upload type. Not all the
image types with this upload type support filesystem customizations
and that's as expected. We could make a more fine-grained test in
the future, but testing with a coulpe of targets should be
sufficient.
2022-02-19 11:13:55 +00:00