Commit graph

2282 commits

Author SHA1 Message Date
Sanne Raymaekers
d13347e1ca cloudapi: Add endpoints to clone aws images across regions
Support for creating multiple amis from a single compose. It uses the
AWSEC2* jobs to push images to new regions, and share them with new
accounts.

The compose it depends upon has to have succeeded.
2022-08-30 16:14:52 +02:00
Sanne Raymaekers
599829a3b8 worker: Return dependent jobs in OsbuildJobStatus 2022-08-30 16:14:52 +02:00
Sanne Raymaekers
0fe3f1b2ae jobqueue: Query job dependents 2022-08-30 16:14:52 +02:00
Sanne Raymaekers
099b34b301 worker: Define new jobs to handle copying and resharing of images
The copy job copies from one region to another. It does not preserve the
sharing on the ami and it's snapshot, that needs to be queued
separately.
2022-08-30 16:14:52 +02:00
Sanne Raymaekers
5f29dc312a distro: Only add rhsm facts stage for RHEL 2022-08-30 15:32:50 +02:00
Sanne Raymaekers
d7b8bb122c cloudapi/v2: Add rhsm facts for non-koji cloudapi composes 2022-08-30 15:32:50 +02:00
Ondřej Budai
fa514c5326 blueprint: remove omitempty from Customizations
See https://github.com/BurntSushi/toml/issues/360

A recent change in BurntSushi/toml made encoding fail (later changed to
error) if a struct is marked as omitempty and is comparable. Go docs about
equality: https://go.dev/doc/go1#equality. Basically: A struct is comparable
if all of its fields are comparable. Slices are not comparable.

Customizations are marked as omitempty but they contain a lot of slices,
thus they are not comparable. The new version of BurntSushi/toml therefore
panics when we encode them.

The solution is to remove the omitempty tag from Customizations.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-08-29 10:25:38 +02:00
Sanne Raymaekers
774cc9e638 cloudapi/v2: Don't add rhsm facts
There are workers everywhere which can't deal with this change just
yet. Let's wait until workers can deal with this before adding facts via
the api.
2022-08-26 18:29:26 +01:00
Simon de Vlieger
c5f335bceb Add the rhsm.facts stage.
We initially provide a Facts file that stores the `ApiType`. This is the
API that was used to request the compose.
2022-08-25 18:56:35 +02:00
Achilleas Koutsou
18abe661a7 distro/fedora: enable hybrid boot for iot-installer 2022-08-25 14:54:56 +01:00
Achilleas Koutsou
b9c636763e distro/rhel8: enable hybrid boot for edge-installer
Regression introduced when unifying distro versions.
2022-08-25 14:54:56 +01:00
Achilleas Koutsou
37e70329a7 distro/rhel9: enable hybrid boot for edge-installer
Regression introduced when unifying distro versions.
2022-08-25 14:54:56 +01:00
Tomas Hozza
af65baa6fe worker/osbuild: use os-release to determine host OS
When running an osbuild job, we read `/etc/redhat-release` to get the
host OS name to attach as metadata to the job result.

Only Fedora and RHEL ship this file, which makes the osbuild job always
fail on other distributions.

The main reason to report host OS back to the worker server is due to
Koji composes and the koji-finalize job, which pushes it to Koji. The
motivation is to have enough information to potentially re-instantiate
/ identify the original builder host OS. There are no specific
requirements on the string.

Modify the code to use `/etc/os-release` to determine the host OS. Fall
back to using `linux` as the host OS, in case reading `os-release`
fails, log the error and continue with the job. The `linux` fallback is
suggested by the `os-release` spec [1]

[1] https://www.freedesktop.org/software/systemd/man/os-release.html#ID=

Co-authored-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-08-25 08:25:35 +01:00
Tomas Hozza
f378209bf3 Simplify trimming of quotes in readOSRelease()
Use standard library function to trim surrounding quotes from read
values. This makes the code shorter and easier to read.
2022-08-25 08:25:35 +01:00
Tomas Hozza
2fba4c2c1f Drop special handling for RHEL < 8.4 in GetHostDistroName()
RHEL-8.3 is EOL and we do not explicitly support it. There is no need to
mangle the host distro name for RHEL-8 releases older than 8.4.
2022-08-25 08:25:35 +01:00
Brian C. Lane
8a67406873 api_test: Use badpackage1 request for FetchError request
This returns the FetchError response setup in mocks/dnfjson for the
search command.
2022-08-23 22:47:46 +01:00
Brian C. Lane
760be50069 mocks/dnfjson: Add mock support for the search command
The search command is more complicated than depsolve and dump. It needs
to return results based on the requested package names and globs.

Add a number of mock responses for the new search command, including
search results, all packages, and error responses that are triggered by
using special package names: nonexistingpkg, badpackage1, baddepsolve.
2022-08-23 22:47:46 +01:00
Brian C. Lane
60986380c4 weldr: Use the SearchMetadata function for globs
Instead of fetching all available packages from dnf-json and then
searching the results this uses SearchMetadata when a package name or
glob is passed to the API. It only uses FetchMetadata when fetching
the full list of packages.

This also fixes a bug where the error response to a projects/info
request used the id of 'ModulesError'. It now uses 'ProjectsError'.
2022-08-23 22:47:46 +01:00
Brian C. Lane
a751dfe71c dnfjson: Add the search support to the Solver
Pass the list of package names or globs to dnf-json and return the
results.
2022-08-23 22:47:46 +01:00
Gianluca Zuccarelli
c264ce53cd distro: add oscap packages to image
Since the oscap remediation stage in osbuild runs
the oscap package in `chroot`, it is necessary to
install the `openscap-scanner` package to the image
itself rather than the build root.
2022-08-23 18:06:15 +02:00
Jakub Rusz
e9a1e66cbe distro/rhel-9: remove nvmf dracut module from image-installer
The module is not present in official RHEL-9.1 ISO image and it is
causing boot issues when used with newer content. HTTP boot is
not affected by this change and works as expected.
2022-08-22 10:11:48 +02:00
Tomas Hozza
0875c3491f distro/rhel9: disable GPG check for Google repos in gce* images
Having the GPG check enabled for Google repos in `gce*` images will make
DNF try to import the relevant keys when upgrading, downgrading or
installing any packages from the repo. However due to Google still using
SHA-1 for GPG keys used to sign their RPMs, importing it will make any
transaction that includes such RPM to fail.

Disabling the GPG check will ensure that DNF won't attempt to import
Google GPG keys.

Related to https://issuetracker.google.com/issues/223626963
2022-08-17 11:59:39 +02:00
Tomas Hozza
55e78e195f distro/rhel9: do not define Google Cloud SDK repo in gce* images
The repo is not needed any more, because the Google Cloud SDK is not
installed in the images by default. If anyone wants to install the SDK,
they can add the appropriate repo definition.
2022-08-17 11:59:39 +02:00
Tomas Hozza
debd6d4342 distro/rhel8: do not define Google Cloud SDK repo in gce* images
The repo is not needed any more, because the Google Cloud SDK is not
installed in the images by default. If anyone wants to install the SDK,
they can add the appropriate repo definition.
2022-08-17 11:59:39 +02:00
Tomas Hozza
5f48aaa212 distro/rhel9: don't install google-cloud-sdk in any gce* images
The Google SDK ships pre-compiled binaries. It is undesirable to install
it by default in `gce` and `gce-rhui` in its current shape. Also not
installing it does not anyhow affect the RHEL integration as the guest
OS in GCP.
2022-08-17 11:59:39 +02:00
Tomas Hozza
cf92c1f23a distro/rhel8: don't install google-cloud-sdk in any gce* images
The Google SDK ships pre-compiled binaries. It is undesirable to install
it by default in `gce` and `gce-rhui` in its current shape. Also not
installing it does not anyhow affect the RHEL integration as the guest
OS in GCP.
2022-08-17 11:59:39 +02:00
Tomas Hozza
a2c46bdf3a distro: rename rhel90 -> rhel9
Make the package and directory naming consistent with RHEL-7 and RHEL-8.
2022-08-17 11:59:39 +02:00
Christian Kellner
dd0be9e439 disk/partition_table: extract customization application into method
Extract the application into a utility method on `PartitionTable`.
In order for it to be usable for the first and second pass it does
take a `create` argument that controlls whether new partitons will
be created or return.
2022-08-08 18:05:05 +02:00
Christian Kellner
b562d144ca distro/*: allow /boot to be customized
Since the LVM support was added to all distros, our disk
related code is adaptive, i.e. we will set the correct BLS
and grub2 prefix if there a `boot` partiton is present in
the layout after all customizations happen, which includes
LVMification.
One thing that was not yet fully working was layouts that
do not yet have a `/boot` partition but allow LVMification.
In that case `NewPartitionTable` and if `/boot` was the
first (or only) customization, would LVMify the partition
which in turn would create the `/boot` partition; but after
`newPT.ensureLVM()` the call to `newPT.createFilesystem`
with `/boot` would try to create another `/boot` mountpoint.
In order to deal with this situation correctly we are now
using a two phase approach: 1) enlarge existing mountpoints
and collect new ones. 2) if there are new ones and LMVify
was allowed, switch to LVM layout. Do a second pass and now
create or enlarge existing partitions, handling `/boot` in
the process.
2022-08-08 18:05:05 +02:00
Christian Kellner
3c3f1b4969 disk: rename MountpointAllowList -> MountpointPolicies
Now that the mountpoint allow is is actually a trie of path
policies we should rename it to better refelct its contents.
2022-08-08 18:05:05 +02:00
Christian Kellner
de52e024a0 disk: use path policy for mount point checking
Replace the simple allow list of paths with the more sophisticated
path policies. It enables us to e.g. allow one path but not any
sub-path. This will be useful for `/boot` where we want to allow
its customization but not any sub-path because that might actually
break booting.
2022-08-08 18:05:05 +02:00
Christian Kellner
9523694879 disk: new path policies struct and methods
Build a new path policy struct, ased on the new path trie struct.
It is designed to be able to store policies for paths. A Check
method can then be used to look up the policy for a given path
based on the defined policies.
2022-08-08 18:05:05 +02:00
Christian Kellner
00555722b2 disk: add generic path trie implementation
Add a simple implementation of a path trie structure that can be
used to look up assoicated data for any given path. The constructor
will build the trie from a dict of paths to associated data. Later
modification is currently not support. Add tests for it creation
and lookup.
2022-08-08 18:05:05 +02:00
Christian Kellner
1ca2efe6cf distro/*: move mount point allow list to disk
All distributions have exactly the same list of allowed mountpoint
customization points. Therefore move it to `disk` and share it
between all distros.
2022-08-08 18:05:05 +02:00
Christian Kellner
2b03a839f0 disk: move mount point checking to central location
Instead of all distribution implementing their own mount point
checking code, we de-duplicate it and move it to `disk`.
2022-08-08 18:05:05 +02:00
Gianluca Zuccarelli
ab250a28a1 distro: add oscap packages to build root
Conditionally add the required packages to the build
root in order to run the OpenSCAP remediation at build
time.
2022-08-04 18:19:06 +02:00
Gianluca Zuccarelli
95046d5fee pipelines: add oscap config for os pipeline
Add config options for oscap in the build pipeline
and add a new stage if the config is not nil.
2022-08-04 18:19:06 +02:00
Gianluca Zuccarelli
86af5ca9d8 distro: oscap customization validation
Add basic validation to ensure that the oscap
customizations are valid and required fields
have been provided. The validation also ensures
that the manifest generation errors out if
oscap customization has been enabled for older
or unsupported distros.
2022-08-04 18:19:06 +02:00
Gianluca Zuccarelli
0cb28f3a8f oscap: add oscap package
Add a package with the constants of the
valid oscap profiles. Add a function to
validate the available profiles against
an allow map of supported profiles. The
allowed function checks for both exact
matches and shorthand versions of the
oscap profiles.
2022-08-04 18:19:06 +02:00
Gianluca Zuccarelli
512cbd6089 osbuild: new stage oscap remediation 2022-08-04 18:19:06 +02:00
Gianluca Zuccarelli
0ef6789cd9 blueprint/customizations: oscap config
Add the required configuration options needed
to run the oscap first boot remediation.
2022-08-04 18:19:06 +02:00
Christian Kellner
388154d7f6 cloudapi: support container embedding
Add support for embedding container images via the cloud API. For
this the container resolve job was plumbed into the cloud api's
handler and the API specification updated with a new `containers`
section that mimics the blueprint section with the same name.
2022-08-04 14:37:12 +02:00
Sanne Raymaekers
1ab3138afe cloudapi: Add test for osbuild job failure due to target errors
The target errors are attached to the details of the osbuild job error.
2022-08-03 13:51:52 +02:00
Sanne Raymaekers
24fab1d5b9 cloudapi: Omit details in compose status job error if nil 2022-08-03 13:51:52 +02:00
Sanne Raymaekers
7b73cf395f cloudapi: Correctly test dependency errors
Dependency errors are not set by the workers, they're not set directly
in the job result. They are added by the worker server in case the job
error indicates it's a dependency error.
2022-08-03 13:51:52 +02:00
Sanne Raymaekers
111feda1f5 worker: Remove ellipsis operator from clienterrors.Error
The ellipsis operator was used as a hack to not need to pass any details
as an argument, but it makes what the end object will actually look like
less obvious. It also makes it impossible to pass an array to details
without getting a nested array.

Fixes #2874
2022-08-03 13:51:52 +02:00
Ygal Blum
ca32d7b729 cloudapi: Make container name and tag optional
If the user does not pass a name, use the distribution as a name
A provided tag is used only if name is provided. It
The tag's default is a generated using UUID to avoid collisions
2022-08-01 21:50:03 +01:00
Ygal Blum
64a3aac895 job/osbuild: move utility the container package
Extract a helper method that parses the reference and applies
defaults, i.e. registry and path, and move it to the contaier
package.
2022-08-01 21:50:03 +01:00
Ygal Blum
3231aabbc0 cloudapi: add support for uploading to a container registry
Worker
------
Add configuration for the default container registry.
Use the default container registry if not provided as part
of the image name.
When using the default registry use the configured values
Return the image url as part of the result.

Composer Worker API
-------------------
Add `ContainerTargetResultOptions` to return the image url

Composer API
------------
Add UploadOptions to allow setting of the image name and tag
Add UploadStatus to return the url of the uploaded image

Co-Developed-By: Christian Kellner <christian@kellner.me>
2022-08-01 21:50:03 +01:00
Jakub Rusz
e0d092538d distro/rhel8+9: exclude qemu-guest-agent package in ec2 and gce images
Related RHBZ#2075815
2022-08-01 13:16:05 +02:00