Commit graph

1708 commits

Author SHA1 Message Date
Achilleas Koutsou
75a96bd99d test: Job args/manifests retrieval
1. Test retrieving the job arguments from the worker using an
   OSBuildJob.
   Very basic test with an empty manifest.
2. Test retrieving job manifests through the Koji API. Uses the existing
   TestCompose test. The returned manifests are empty for all cases.
2021-01-16 13:39:30 +01:00
Achilleas Koutsou
8f4c72b0a3 kojiapi: Fix common typo in comments 2021-01-16 13:39:30 +01:00
Achilleas Koutsou
7ec084fa56 kojiapi: Add endpoint for retrieving job manifest
Add and implement an API endpoint that returns the manifests for a given
osbuild-koji job. The route returns an array of manifests, one for each
image in the request.

Retrieves the arguments of each Build Job to extract the Manifest.
2021-01-16 13:39:30 +01:00
Achilleas Koutsou
1c5f6810be worker: Add JobArgs() method
Wraps jobqueue.JobArgs() method and unmarshals data into the provided
concrete struct value. The struct should match the requested job type of
the given ID.
2021-01-16 13:39:30 +01:00
Achilleas Koutsou
6967333759 jobqueue: Add JobArgs() method
JobArgs() returns the arguments submitted with a job in raw form.
Since the structure of the args are opaque to job queue, it's the
responsibility of the caller to deserialize the arguments.

Args retrieval is added to the existing TestArgs() function.
2021-01-16 13:39:30 +01:00
Ondřej Budai
c03296b3f8 schutzbot: prolong the timeout to 12 hours
With our limited number of machines in OpenStack, we cannot run unlimited jobs
in parallel. When there's a lot of activity in the repository, there's a high
probability that a job must wait for a free VM for quite a long. In these cases,
tests commonly fail due to the timeout.

I decided to prolong the timeout to 12 hours. This should lower the amount of
these kinds of jobs.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-01-16 13:36:47 +01:00
Tomas Hozza
7f5e36dd94 image-types: Update RHEL8 Amazon EC2 image information
Add note about the most common way to consume Red Hat content using this
type of image.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-01-15 17:48:19 +01:00
Tomas Hozza
b6c6479663 image-types: Update RHEL8 KVM Guest image information
Add the latest information about the intended use of this type of
image. Also add note about the most common way to consume Red Hat
content using this type of image.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-01-15 17:48:19 +01:00
Lars Karlitski
985def36f3 .github: add checklist to PR template 2021-01-15 13:21:12 +01:00
Lars Karlitski
72f83f9694 docs/news: introduce release notes directory
This directory is meant for longer-form release notes. Add a README.md
that explains it.
2021-01-15 13:21:12 +01:00
Lars Karlitski
7a5790d6b7 .github: move text in the PR template into a comment
The majority of pull requests do not fix a downstream issue. In
practice, people usually delete the whole suggested content.

Move it into a comment, so that this step is unnecessary.
2021-01-15 13:21:12 +01:00
Ondřej Budai
3f15b97af0 rhel84: fix kernel cmdline for s390x
RootFsUUID should be the UUID of a root filesystem, not of a root partition.

🤦 sorry!

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-01-14 20:29:52 +01:00
Jacob Kozol
45138801f9 distro/rhel84: fix s390x kernel options
Our s390x images now use the kernel commandline options set in the image
type's declaration.
2021-01-14 12:59:31 +01:00
Jacob Kozol
9d0d5967d6 distro/rhel84: use New York as default timezone
RHEl 8.4 guest images need to have the default timezone of EST/EDT
unless the user specifies one in their blueprint. New York is a major
location for this timezone.
2021-01-13 17:49:51 +01:00
Tomas Hozza
fc6fbec32f test/image: Fix test cases directory path in doc and code
The directory with image-tests test cases has been renamed from `cases`
to `manifests`. This has not been previously reflected in the test/README.md
and osbuild-image-tests code. osbuild-image-tests hardcodes the test
cases directory path and uses it in case no test case are passed
to it on the command line. Since the image_tests.sh CI test case looks
for image-tests test cases in the correct directory and passes the
relevant ones to osbuild-image-tests, the CI didn't detect this issue.

Running osbuild-images-tests without any argument and let it run all
test cases from the default test cases directory as part of CI probably
does not make sense. Due to this reason, I'm not adding any new test.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-01-12 15:36:52 +01:00
Lars Karlitski
cb894ccf68 jobqueue: remove testjobqueue
testjobqueue did not implement the JobQueue interface correctly (noted
in its package comment), making it impossible to write tests for
JobQueue itself.

Replace its use everywhere with fsjobqueue operating on a temporary
directory.
2021-01-12 12:19:25 +01:00
Lars Karlitski
90e15da032 kojiapi/test: use the worker of the fixture
No need to create a second one.
2021-01-12 12:19:25 +01:00
Tomas Hozza
d9f09c66f2 tools: Fix checking of args number in deploy-qemu
When the deploy-qemu script is run with less than 2 arguments, it ended
with error, instead of printing usage. This was due to using 'set -u' and
trying to expand unset variables "$1" and "$2" as part of checking if
they were provided. The issue has been fixed by checking number of
provided arguments, instead of their content. The same approach is used
in 'deploy-openstack' script.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-01-11 10:33:51 +01:00
Jacob Kozol
da6f5ba701 kojiapi,cloudapi: exclude packages when depsolving
When rpmmd's Depsolve function is called we need to pass in the image
type's excluded packages. These excluded packages are retrieved when we
get the packages we include from each image type.
2021-01-06 21:34:37 +01:00
Ondřej Budai
1b05192298 upload/azure: use the new azure/azblob API on Fedora 33+ & RHEL
Fedora 33 and rawhide got an updated version of the azblob library. Sadly, it
introduced a non-compatible API change. This commit does the same thing as
a67baf5a did for kolo/xmlrpc:

We now have two wrappers around the affected part of the API. Fedora 32 uses
the wrapper around the old API, whereas Fedora 33 and 34 (and RHEL with its
vendored deps) use the wrapper around the new API. The switch is implemented
using go build flags and spec file magic.

See a67baf5a for more thoughts.

Also, there's v0.11.1-0.20201209121048-6df5d9af221d in go.mod, why?

The maintainers of azblob probably tagged a wrong commit with v0.12.0 which
breaks go. The long v0.11.1-.* version is basically the proper v0.12.0 commit.
See https://github.com/Azure/azure-storage-blob-go/issues/236 for more
information.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-01-06 16:31:28 +01:00
Sanne Raymaekers
946a0b425a containers: Specify port for the composer-api as argument 2020-12-23 17:31:29 +01:00
Tom Gundersen
73deee0f43 tools: add delpoy script for clouddot
This will be invoked by the cloud.redhat.com infrastructure to deploy
composer containers to quay.io.
2020-12-22 15:27:39 +01:00
Tom Gundersen
c3185466ae containers: simplify Dockerfile and container build
This changes the following:
 - Only produce one container. There is no particular benefit to
   supporting several different base containers, so unify on ubi
   as that is what we need ourselves.
 - Build directly from git. Now that the RPM we include in our
   container does not have any dependencies and only contains a
   couple of executables, the indirection via RPM has less value.
   Eventually the value will be reduced even further as we merge
   the entrypoint into the main binary and move dnf-json into the
   worker, leaving us with only a go binary. The only potential
   benefit might be that the build environment of RPMs is more
   clearly defined, but there is no real reason to believe that
   our mockbuild is any better than using the UBI golang build
   container.

This simplifies the container builds, and brings us more in line
with what is done in image-builder, and what is needed to deploy
to openshift.
2020-12-22 15:27:39 +01:00
Tom Gundersen
c9077c8a7f schutzbot: don't build containers for aarch64
We do not yet build all our packages for aarch64, so this would
fall back on the RPMs in the repository. In `main` that seems to
work, as osbuild-composer exists in the base repositoires. Though
we obviously want to test the most recent commit, not the released
RPM, so this is maksing the problem.

As of this PR, the build would fail though: We are now build
UBI containers, where osbuild-composer does not exist, and we have
split the RPM into the new osbuild-composer-core, which does not
yet exist in any base repository.
2020-12-18 22:53:07 +01:00
Tom Gundersen
397c374b8b schutzbot/containerbuild.sh: add ubi8
In addition to the fedora containers, also build an ubi8container,
which is needed to deploy into our OpenShift instance.
2020-12-18 22:53:07 +01:00
Tom Gundersen
21beab0617 dockerfile: install osbuild-composer-core
This no longer pulls in systemd/worker, saving space and makes it
suitable for use in a UBI container, where qemu-img is not available.

This drops support for --inbuilt-worker from entrypoint.py. The script
could be simplified further in a future commit, or folded into the
main binary.
2020-12-18 22:53:07 +01:00
Tom Gundersen
9fcd6a1e19 spec/core: introduce new sub-package
This package is init-system independent and can be used in a container
without systemd/worker installed.
2020-12-18 22:53:07 +01:00
Tom Gundersen
3c42339339 spec/worker: move qemu-img dependency
It is the worker that uses qemu-img, not composer itself.
2020-12-18 22:53:07 +01:00
Ondřej Budai
d423007482 tests: move the epel dependencies to provisioning
koji and ansible are not in RHEL repositories. Depending on them breaks RHEL
gating (see OSCI-1541): It tries to build a custom image with -tests package
in it but in the build environment there's no EPEL.

This commit makes the RPM independent from EPEL. However, we still need koji
and ansible, so the provision script now enables EPEL and installs the packages
from there. This is not nice but we have to live with that until OSCI-1541 is
solved.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-18 09:04:38 +01:00
Ondřej Budai
a1b730d536 tests: pre-install EPEL for koji-osbuild rev dep test on RHEL
koji-osbuild-tests depends on koji which is not available in RHEL. As we need
to get rid of EPEL from deploy.sh (see the following commit), we need a
mechanism to preinstall EPEL before koji-osbuild-tests is installed. This
commit introduces pre_install_packages to Schutzfile - a simple way to
install packages before ${PROJECT}-tests is installed.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-18 09:04:38 +01:00
David Rheinsberg
21c7b7463c containers: add containerized osbuild-composer
Add a Dockerfile that creates a container based on Fedora with
osbuild-composer deployed. Create a suitable entrypoint that runs
osbuild-composer in the container and creates the required sockets
without systemd.

To test this, build the container via:

    docker build ./containers/osbuild-composer

Then create your certificates in /etc/osbuild-composer/. Then run
composer with something like:

    docker run --rm -v /etc/osbuild-composer:/etc/osbuild-composer <id>

(Where <id> is the container ID returned by `docker build`.)
2020-12-17 12:46:59 +01:00
Ondřej Budai
c0a33c6852 26
Release osbuild-composer 26

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-16 18:54:26 +01:00
Ondřej Budai
3562833f6c schutzfile: bump koji-osbuild
This should fix the CI.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-16 17:19:31 +01:00
Ondřej Budai
1dd4eb7e38 composer: seed the random number generator
I thought rand in Go is auto-seeded but I was wrong, see [1].
This commit adds seed initialization.

[1]: https://golang.org/pkg/math/rand/#Seed

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-15 21:26:40 +01:00
Ondřej Budai
973639d372 distro/rhel84: use a random uuid for XFS partition
Imagine this situation: You have a RHEL system booted from an image produced
by osbuild-composer. On this system, you want to use osbuild-composer to
create another image of RHEL.

However, there's currently something funny with partitions:

All RHEL images built by osbuild-composer contain a root xfs partition. The
interesting bit is that they all share the same xfs partition UUID. This might
sound like a good thing for reproducibility but it has a quirk.

The issue appears when osbuild runs the qemu assembler: it needs to mount all
partitions of the future image to copy the OS tree into it.

Imagine that osbuild-composer is running on a system booted from an imaged
produced by osbuild-composer. This means that its root xfs partition has this
uuid:

efe8afea-c0a8-45dc-8e6e-499279f6fa5d

When osbuild-composer builds an image on this system, it runs osbuild that
runs the qemu assembler at some point. As I said previously, it will mount
all partitions of the future image. That means that it will also try to
mount the root xfs partition with this uuid:

efe8afea-c0a8-45dc-8e6e-499279f6fa5d

Do you remember this one? Yeah, it's the same one as before. However, the xfs
kernel driver doesn't like that. It contains a global table[1] of all xfs
partitions that forbids to mount 2 xfs partitions with the same uuid.

I mean... uuids are meant to be unique, right?

This commit changes the way we build RHEL 8.4 images: Each one now has a
unique uuid. It's now literally a unique universally unique identifier. haha

[1]: a349e4c659/fs/xfs/xfs_mount.c (L51)
2020-12-15 16:43:39 +01:00
Ondřej Budai
ae0d1b8663 distro/rhel84: remove hardcoded root partition UUIDs
Let's use the root partition UUID from the partition table instead of
hardcoding the value.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-15 16:43:39 +01:00
Ondřej Budai
d52c1ea1f8 distro/rhel84: generate fstab stage from partition table
Now that we have an abstract partition table definition, we can use it to
generate org.osbuild.fstab stage options.

This is extremely nice because it removes magic contains.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-15 16:43:39 +01:00
Ondřej Budai
76926ecd35 distro/rhel84: encode the partition table using abstract data-types
Using osbuild.QEMUAssemblerOptions to encode a partition table was weird.
This commit introduces a disk package that contains data types for defining
partition tables. Also, there's a handy function to convert the abstact
partition table to osbuild.QEMUAssemblerOptions.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-15 16:43:39 +01:00
Ondřej Budai
a9c367ab4a distro/rhel84: factor partition table definition out of assembler
Previously, the partition table definition was defined inside an assembler.
This has an issue though: The partitions and filesystems are needed at several
other places, e.g. grub2 stage and fstab stage. As the partition table was
basically hardcoded, this didn't matter - we could just use constants
in these stages. Not ideal but it worked.

This commit changes the behaviour: A partition table is firstly created and
then it's passed to the assembler function where complete assembler options
are created out of it.

To make this change as small as possible, osbuild.QEMUAssemblerOptions type
is used to encode the partition table for now.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-15 16:43:39 +01:00
Ondřej Budai
e725ca0dd5 distro/test: improve manifest diffing
require.JSONEqf cannot handle diffs of such a big entity as a manifest is.
It just prints an empty string.

This commit unmarshalls the manifests instead and then uses the cmp library
to make a very nice and readable diff.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-15 16:43:39 +01:00
Jacob Kozol
51c08105fe distro/rhel84: update kernel options
The kernel options are updated to remove the read only option "ro" from
the qcow2 and amazon image types. Also, the qcow2's kernel options are
updated to only set console=ttyS0 once. It was declared twice which is
redundant so now it is set for both tty0 and ttyS0.
2020-12-11 18:53:30 +01:00
Tomas Hozza
5348cd1a3d spec: build & install osbuild-composer(7) man-page
Build the osbuild-composer(7) man-page as part of the RPM build and
include it in the osbuild-composer RPM. Previously the man-page was not
shipped at all in any of the produced RPMs.

make is currently included in the Fedora buildroot, however there is a
plan to remove it since F34. Since make is now used in the %build
section, it should be listed explicitly as a BuildRequires.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2020-12-09 15:12:39 +01:00
Jacob Kozol
a827e594bf distro/rhel84: remove rng-tools
rng-tools is no longer included as a package in the RHEL 8.4 image. This
package is both removed from being an included package and also
specifically declared as excluded. The test manifests are updated.
2020-12-08 14:04:40 +01:00
Christian Kellner
f0896be0c0 distro/rhel84: use the org.osbuild.rhel84 runner
The RHEL 8.4 specific runner was introduced in osbuild 22, released
on the 8th of October 2020. It should by now be in relevant Fedora
releases and RHEL 8.4.
Adapt the corresponding test cases.
2020-12-04 19:28:44 +01:00
Ondřej Budai
39cf864b16 drop the osbuild submodule
64432c70 promised to remove it but this didn't actually happen. We don't
use the submodule anymore so let's indeed drop it this time.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-02 13:00:59 +01:00
Ondřej Budai
3d465a4778 api/koji: invert the compose status condition
This is just easier to grasp.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-02 10:27:31 +01:00
Ondřej Budai
00cd4cb346 api/koji: return pending status until all jobs are finished
Previously, the compose status returned failure as soon as possible.
koji-osbuild considers the job as done when its status == failure and proceeds
with uploading the logs to koji and marking the job as failed. However, not
all osbuild-composer jobs might be done at this point so the logs might be
incomplete making the debugging hard.

This commit changes the behaviour: Now, the compose status is pending until
ALL jobs belonging to it are finished.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-02 10:27:31 +01:00
Ondřej Budai
e10a7f1ccc {koji,worker}/server: log errors returned from handlers
Previously, we had no clue what errors were catched by the default echo's
error handler. Thus, in the case of an error, we were basically blind. Let's
log all errors so we can investigate them later.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-02 08:52:27 +01:00
Ondřej Budai
cbc9082fac tests: move the libvirt test logic out of Jenkinsfile
All tests in /usr/libexec/tests/osbuild-composer should be able to run without
any arguments. This was not a case of libvirt.sh - it required two arguments
set by some Jenkinsfile logic.

This commit moves test/cases/libvirt.sh to tools/libvirt_test.sh and extracts
the logic controlling the test case from Jenkinsfile to test/cases/libvirt.sh.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-02 08:44:33 +01:00
Ondřej Budai
8963613e91 tests: rename qemu test to libvirt test
This test case doesn't use qemu directly, libvirt is more appropriate name.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-02 08:44:33 +01:00