Commit graph

204 commits

Author SHA1 Message Date
Alexander Todorov
42480f7b26 tests: Cleanup leftover 8.4 references 2021-08-19 12:21:52 +02:00
Ondřej Budai
3f7e815a80 tests: define compose url also for RHEL 9.0
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-17 16:54:22 +02:00
Ondřej Budai
cbe11e280b test/manifests: generate all test manifests for rhel-90
This commit also updates the rpmrepo snapshot for rhel-90 to the latest one.

Note that vmdk and vhd images are currently not buildable, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1989841

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-11 11:22:59 +02:00
Achilleas Koutsou
ab264abd76 distro/rhel85: tar-installer -> image-installer
Renamed tar-installer to image-installer.
This is a more appropriate name:
- It disassociates the image type from the "tar" image type. The two
  should not be perceived to be connected.
- It's more descriptive. The format of the payload (tar) isn't relevant
  to the purpose of the image type.
2021-08-11 01:31:47 +02:00
Achilleas Koutsou
7d08535232 test/data: Add tar-installer test manifest
Added to format-request-map and generated manifest.
No image-info since ISOs aren't supported by the tool. The manifest is
useful only for detecting changes in the image type definition.
2021-08-05 16:13:46 +02:00
Tomas Hozza
aed3bf785c image-info: mount partitions in correct order when analysing image
image-info's code which analysed image with multiple partitions was not
correctly working with more than two partitions, which had to be the
root '/' and EFI partition '/boot/efi'. The consequence was that SELinux
labels on paths which were mounted incorrectly could have been reported
as incorrect.

Modify `append_partitions()` to first read the fstab entries and then
mount all partitions using their UUID in the correct order. Only then
analyze the image filesystem tree.

Regenerate affected image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-05 09:34:07 +02:00
Tomas Hozza
972515ad84 image-info: ignore lines with only whitespace characters in fstab
image-info could produce a weird fstab error with an empty list as a
member, when analysing images not built using osbuild. Ensure that any
lines in fstab with only whitespace characters are skipped during image
analysis.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-05 09:34:07 +02:00
Tomas Hozza
c97420e879 rhel85: add definitions of RHEL ec2 and ec2-ha images
Add new image type definitions `ec2` and `ec2-ha` representing the
official RHEL ec2 image types.

Add a `xzArchivePipeline()`, which returns a pipeline producing a XZ
archive from a file produced by a different pipeline.

Add rpmrepo snapshots for `rhui` and `ha` repositories used to generate
image test cases. `rhui` is used by the `ec2` image and it is available
on x86_64 and aarch64 architectures. `ha` is used by the `ec2-ha` image
and it is available only for x86_64.

The new image type definitions are currently not used by any
API test case.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Tomas Hozza
02ff0fc606 rhel85: redefine the ami image based on RHEL ec2 images
Redefine the `ami` image type in RHEL-8.5 to be based on RHEL
ec2 images. The pipeline has different default settings, therefore the
common "os" pipeline is not used. The RHEL ec2 images have a different
default size than the original `ami` image definition. The RHEL ec2
images use a different default partitioning scheme. Their configuration
is slightly different for each architecture and the x86_64 version
of the image does not support UEFI.

Update rpmrepo snapshots used to generate RHEL-8.5 x86_64 and aarch64
image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Juan Abia
c4fa4e4bb7 test: Replace hard coded ssh keys on some test
Generate a new ssh key each time. Only implemented on bash test scripts,
go tests pending.
2021-07-29 09:38:03 +03:00
Achilleas Koutsou
67c5e099ed tools: flush print in test case generator
When not flushed, the line often doesn't get printed until after the job
is done. Printing it before the job is useful for knowing the progress
of a multi-job run.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
8fc74d1e73 tools/test-case-generators: update distro map
Added RHEL 8.5 image types to distro-arch-imagetype map
2021-07-24 15:54:00 +02:00
Tomas Hozza
a9ecf5a839 image-info: cover situation when /boot is on a separate partition
Some images with ESP, e.g. the `rhel-ec2-aarch64`, have the `/boot` on
a separate partition. `image-info` currently produces traceback on such
images, e.g.:

Traceback (most recent call last):
  File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1997, in <module>
    main()
  File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1991, in main
    report = analyse_image(target)
  File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1863, in analyse_image
    append_partitions(report, device, loctl)
  File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1849, in append_partitions
    append_filesystem(report, tree)
  File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1809, in append_filesystem
    with open(f"{tree}/grub2/grubenv") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp3i__6m1w/grub2/grubenv'

The reason is that `grub2/grubenv` on the `/boot` partition is a symlink
to `../efi/EFI/redhat/grubenv`. However the `efi` directory on the
`/boot` partition is empty and the ESP must be mounted to it for the
expected path to exist.

Modify `image-info` to mount the ESP to `efi` directory if it exists on
the inspected partition.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-15 11:32:17 +02:00
Ondřej Budai
5e8c022e6d docs: document the release process
This commit adds RELEASING.md guide describing the process of making a new
upstream release and pushing it into Fedora and CentOS Stream 9.

Additionally, a new helper is added to the repository - update-distgit.py.
The purpose of this helper is to simplify work with the dist-git.

Random thoughts:
I decided to left off RHEL 8 because the guide would be full of internal
URLs and tools. I will probably write a similar guide for it and put it
into internal guides.

I decided to just reference the RHEL Developer Guide for CentOS Stream 9.
It's pretty well written and I didn't feel like duplicating the effort.

We should definitely switch to PR-based approach for Fedora and implement
at least some smoke tests. I believe that the current guide is good enough
and we can iterate later.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-14 12:11:35 +02:00
Ondřej Budai
f8fd3d04b8 test/fedora33: use rpmrepo instead of kernel mirrors
mirrors.kernel.org are sometimes desynchronized, and thus causing issues with
the image tests. This commit switches the image tests for F33 to use RPMRepo.

All test cases were regenerated.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-14 12:05:45 +02:00
Jakub Rusz
0b962c9185 ci: add slack notfications
This sends a message to a slack channel if a scheduled pipeline is
ran and reports either failure or success.
2021-07-12 11:21:01 +03:00
Brian C. Lane
2b99e9e894 tests: Copy over test repos for RHEL point releases 2021-07-12 08:58:42 +02:00
Ondřej Budai
78ef247042 bump minimum go version to 1.15
The oldest distributions that we now support are RHEL 8.4 and Fedora 33.
They both support go 1.15, let's bump.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-07 17:26:18 +01:00
Achilleas Koutsou
034bdaafab distro-arch-imagetype-map: add new distro and types 2021-06-29 17:26:43 +01:00
Achilleas Koutsou
0bac6806f5 tools/provision: set up nightly repos for RHEL 8.5 2021-06-29 17:26:43 +01:00
Achilleas Koutsou
4651b8ba22 tools: add 8.5 edge types to format request map
For test case generation. These are the new names used by the 8.5 edge
image types.
2021-06-29 17:26:43 +01:00
Jakub Rusz
905c297bc7 tests: enable nightly test execution in gitlab CI
This adds several stages to the gitlab-ci.yaml file which are
triggered by a schedule specified in Gitlab->CI/CD->Schedules
2021-06-25 15:10:40 +03:00
Ondřej Budai
86baf4879a tools/deploy-qemu: use sys.exit instead of exit
exit is just a helper for the interactive shell, see:

https://stackoverflow.com/questions/6501121/difference-between-exit-and-sys-exit-in-python
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-06-22 14:45:54 +02:00
Ondřej Budai
99d1d4e5d0 tools/deploy-qemu: use default temp dir location
Previously, the temporary directory was created in the script dir. It just
imo created unnecessary and confusing files in my git checkout. Let's just
use the default temporary directory because we don't really have special
needs for it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-06-22 14:45:54 +02:00
Tomas Hozza
bce603586e image-info: changes related to reading SELinux labels unknown to host
When `image-info` inspects ostree images, the `/usr/etc` is bind-mounted
to `/etc`. This results in conflicting SELinux policy specification for
these files and makes the outcome dependent on the `setfiles` build.
All the files in `/etc` have mismatch in the expected vs. actual SELinux
context.

Exclude `/etc` from the check of SELinux ctx mismatches in case the
analysed tree is from an ostree-based image.

Sort the list returned `read_selinux_ctx_mismatch()` based on the item's
`filename` key, to make the result consistent across runs.

`image-info` can not read SELinux labels from the images, which are not
known to the host. This makes the report content depend on the host
environment. As a temporary workaround, relabel the image-info script with
osbuild_exec_t label to allow it to read unknown SELinux labels.

Modify documentation in `test/README.md` to explain the issue with
`image-info` and unknown SELinux labels.

Modify the `generate-all-test-cases` to relabel `image-info` before
generating test cases.

Modify the `image_tests.sh` to relabel `image-info` before running image
test cases.

Add 'tar' image for 'rhel-8' on 's390x' back to the matrix of generated
test cases, as it was removed by mistake. Regenerate the image test
case. Remove 'tar' image from 'rhel-84' on 's390x' from the matrix of
generated test cases, as it is not supported.

Regenerate all affected image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-22 13:25:59 +03:00
Tomas Hozza
0f3c25824d Image test cases: remove Fedora 32 (EOL)
Remove Fedora 32 image test case manifests, because the release
is already EOL. Remove Fedora 32 definitions from
`distro-arch-imagetype-map.json`. Remove Fedora 32 repositories
from `tools/test-case-generators/repos.json`.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-21 16:15:53 +03:00
Martin Sehnoutka
1fffb57a4c deploy-qemu: rewrite in python
The discussion about Bash syntax have reached the threshold where it is
necessary to rewrite the script in Python to make everyone's life
easier.
2021-06-15 09:53:53 +02:00
Ondřej Budai
bc1a7dc30c tests: fix journalctl killing once again
3a8c6c8a introduced a new logic for killing journalctl. Unfortunately, it
doesn't work properly. In ostree tests, multiple journalctls are spawned
but there can be only one trap active at a time. This caused all but the last
journalctls to hang indefinitely. Unfortunately, hanging background processes
is something that causes the GitLab CI to hang indefinitely as well.

This commit modifies the logic a bit: The trap is still set. However, there's
also an explicit kill of journalctl after the compose is finished. After the
process is successfully killed, the trap is removed.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-06-10 07:40:36 +02:00
Tomas Hozza
244cb35eca image-info: fix read_partition() call
One occurrance of read_partition() call have not been modified as part of
previous commit [1], which is a bug.

[1] 598c2b6939

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-09 18:23:00 +02:00
Tomas Hozza
a2d4ba715f Extend information gathered by image-info tool
This is a preparation for defining EC2 images for RHEL-8.5.0. These
extensions to image-info tool represent modifications done to the
official EC2 images currently produced as RHEL release. It is important
to be able to analyse these aspects of images, before we define them in
osbuild-composer, to ensure that the resulting images will be consistent
with the current state.

- Read non-empty lines from /etc/hosts file and add them to the report.
- Read content of /etc/machine-id and add it to the report.
- Read uncommented key/values from /etc/systemd/logind.conf and add them
  to the report.
- Read all ifcfg-* files from /etc/sysconfig/network-scripts/ and add
  their values to the report.
- Read content of /etc/locale.conf and add it to the report.
- Read SELinux configuration from /etc/selinux/config and add it to the
  report.
- Inspect the filesystem tree for SELinux context mismatches and add
  them to the report.
- Read configuration files from /etc/modprobe.d/ and for now report only
  all blacklisted kernel modules.
- Read RHSM configuration from /etc/rhsm/rhsm.conf and add it to the
  report.
- Read cloud-init configuration from /etc/cloud/cloud.conf and add it to
  the report.
- Read all *.conf files from /etc/dracut.conf.d/ and add their content to
  the report.
- Read VC and X11 keyboard configuration and add it to the report.
- Read specific configuration directives from Chrony configuration and
  add them to the report. Specifically 'server', 'pool', 'peer' and
  'leapsectz'.
- Read drop-in configurations for *.service unit files from
  /etc/systemd/system/ and add them to the report.
- Read all configuration files from /etc/tmpfiles.d/ and add them to the
  report.
- Read all configuration files from /etc/sysctl.d/ and add them to the
  report.
- Read the Tuned active profile and profile mode and add them to the
  report.
- Read all configuration files from /etc/security/limits.d and add them
  to the report.
- Read sudoers configuration from /etc/sudoers and files in
  /etc/sudoers.d/ and add uncommented lines to the report. No
  sophisticated parsing is done, because the configuration format
  grammar is too complicated for the purpose of image-info.
- Read udev rules configuration files from /etc/udev/rules.d/ and add
  them to the report.
- Read DNF configuration and defined vars and add them to the report.
- Read profile ID and enabled features used by authselect.
- Enable SELinux, extended attributes and POSIX ACLs support when
  unpacking 'tar' image type to prevent potential mismatches

Regenerate all image test cases to reflect changes in the image-info
output. Modify the distro-arch-imagetype-map.json to cover all
combinations currently covered by existing image test cases.

Add doc strings to all read_* functions.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-09 18:23:00 +02:00
Jakub Rusz
3a8c6c8ab8 tests: kill journalctl even if compose fails
This prevents Gitlab CI from getting stuck if something
goes wrong with the compose.
2021-06-04 14:18:11 +03:00
Ondřej Budai
bb60905309 test/libvirt: remove dead code
We don't test vmdk images in libvirt.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-05-17 14:55:50 +02:00
Ondřej Budai
3bf04d12f8 test/libvirt: use a minimal blueprint
All our images now support and have enabled cloud-init, there's no need
to explicitly enable it and install it in a kickstart.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-05-17 14:55:50 +02:00
Jakub Rusz
8dcf859473 tests: move some integration tests to gitlab CI
This also includes several modifications to tests scripts to
enable them running in gitlab CI.
2021-05-12 15:38:30 +03:00
Alexander Todorov
57cebbfaea tests: Define COMPOSE_URL/COMPOSE_ID in a single place. Fix #1397
we don't want this defined multiple times in different places
2021-05-12 09:26:31 +02:00
Achilleas Koutsou
68a81c15fe tools: add RHEL 8.5 repos for test case generator 2021-05-11 12:10:09 +02:00
Alexander Todorov
ef0105945a tests: Revert a lorax patch
BZ 1843704 has been fixed and shipped in 8.3. We shouldn't need this
patch anymore!
2021-04-22 15:03:42 +03:00
Tomas Hozza
f570cf51b7 tools/image-info: don't convert raw images
After change to image-info [1], which shows the format version for qcow2
images, the `image-format` changed from string to a dictionary. However
the `open_image()` function still compares it with string. This causes
`raw` images to be converted by the script again to `raw` format. This
change fixes the issue, so that `raw` images are not converted, but used
as they are.

[1] 5937b9adca

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-04-21 17:57:48 +02:00
Ondřej Budai
e7b3063f7e test: properly kill journalctl
sudo journalctl -af -n 1 -u "${WORKER_UNIT}" &
WORKER_JOURNAL_PID=$!

In this snippet, WORKER_JOURNAL_PID is set to the PID of the sudo process.
Sudo doesn't propagate any signals - therefore the child process of sudo
(journalctl in this case) isn't killed when a signal is sent to the parent.

Use pkill -P instead which kills all processes where sudo is the parent.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-04-14 09:18:06 +02:00
Christian Kellner
5937b9adca image-info: show format version for qcow2
Change the "image-format" from a string to a dict, with a "type":
$value entry, where $value contains the previous plain string
data.
Additionally, include the qcow2 format version, if the given
image is indeed a qcow2.
Adapt all manifest test accordingly (partly done by Ondřej)

Python 3 script used for conversion of manifest tests:
import os
import json

for name in os.listdir(os.getcwd()):
    if not name.endswith(".json"):
        continue
    print(name)
    with open(name, "r") as old:
        data = json.load(old)
        info = data.get("image-info", {})
        format = info.get("image-format")
        if not format:
            continue
        info["image-format"] = {
            "type": format
        }
        if format != "qcow2":
            continue
        info["image-format"]["compat"] = "1.1"
        with open(name + ".new", "w") as new:
            json.dump(data, new, indent=2)
            new.write("\n")
            new.flush()
    os.rename(name+".new", name)

test: use the new image-info format in all test manifests

The previous commit converted only qcow2 and openstack manifests but this change
is actually needed for all manifests produced by the qemu assembler.

Co-Developed-by: Ondřej Budai <ondrej@budai.cz>
2021-04-10 10:06:11 +02:00
Ondřej Budai
54a458af5c test: replace genisoimage with mkisofs
genisoimage might be removed from RHEL 9. The users are advised to switch
to mkisofs tools from the xorriso package. It should be a drop-in replacement.

The same change was recently done by libguestfs:

efb8a766ca
2216ab2e32

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-04-02 14:21:29 +02:00
Jozef Mikovic
dc31fb3f21 repositories: use snapshots for rhel90 repos 2021-03-26 14:05:20 +00:00
Jozef Mikovic
165ecafeb2 test: use DISTRO_CODE to select tests case
Using DISTRO_CODE simplifies test case selection and allows to test
different distro than the one test is running on.
This is used to run tests for RHEL 9.0 on F33 or RHEL 8.4
2021-03-26 14:05:20 +00:00
Jozef Mikovic
a9e8ea2a21 distro/rhel90: add RHEL9 support
osbuild-composer can now build rhel 9.0 images.
Added support is limited to qcow2 image type.
2021-03-26 14:05:20 +00:00
Ondřej Budai
dbee4cdbd1 tools/generate-test-cases: fix missing comma
This slipped in aeddf7e501 and
survived 28aaa129ff, let's fix it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-18 12:31:01 +01:00
Achilleas Koutsou
f317b0a3d9 test/data: test cases for rhel-edge-container 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
28aaa129ff generate-test-cases: export flag for osbuild call
osbuild requires the export flag otherwise it wont produce an artifact.
For the older manifest format (v1), the export value is always
"assembler".  For v2 manifests, it is the name of the last pipeline.

If an unknown version number is read the script now fails.  This should
help catch manifest changes that may affect test case generation in the
future.
2021-03-17 18:12:17 +00:00
Tom Gundersen
ddc4013dbf generate-all-test-cases: don't wipe store
Afetr a run, a store contains downloaded rpm's and whatever pipelines
were checkpointed. We want to reuse these for subsequent runs, so
don't delet the store.
This risks minimally increasing the disk space usage, but should speed things up significantly.
2021-03-15 16:40:48 +00:00
Tom Gundersen
aeddf7e501 generate-test-cases: checkpoint build root
Most of the images for a given distro share a build-root, checpoint it to avoid having to recreate it.
2021-03-15 16:40:48 +00:00
Christian Kellner
8da813ecd2 rhel84: use en_US.UTF-8 as default for LANG
Use en_US.UTF-8 as default for LANG, which is what previously was
used and is also needed to properly work on non-us/latin setups[1].

In the customization tests, use a different value than the default
one to check that the customization does in fact work.

[1] http://git.app.eng.bos.redhat.com/git/spin-kickstarts.git/tree/rhel8/rhel-8.2-kvm-x86_64.ks#n4

Co-authored-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-03-09 21:45:27 +00:00