Commit graph

1922 commits

Author SHA1 Message Date
Jordi Gil
00a84d1fdc distro: allow user and group customizations for iot-installer 2022-05-09 12:25:21 +02:00
Jordi Gil
6c11c27c48 distro/fedora: removed old fedora code 2022-05-09 12:25:21 +02:00
Jordi Gil
f14dc2fb63 distro/fedora: refactor based on RHEL 9.0 code 2022-05-09 12:25:21 +02:00
Tomas Hozza
0bf67dfad5 Stop setting the StreamOptimized option in Weldr and Cloud APIs
The VMDK image is already produced as stream-optimized. Therefore stop
setting the `StreamOptimized` option in `OSBuildJob` structure by both,
Weldr and Cloud APIs.

Keep the handling of the option in worker for backward compatibility,
in case an older instance of Composer server is used, which does not
produce VMDK manifests as stream-optimized. In such case, the worker
needs to convert the image.
2022-05-04 16:22:29 +02:00
Tomas Hozza
be6675d54e distro(all): produce VMDK as stream-optimized
Modify pipelines in all distro definitions to produce stream-optimized VMDK
image.

Regenerate all VMDK test cases.

Bump worker dependency on osbuild to the version supporting VMDK
subformat in both QEMU assembler and stage
2022-05-04 16:22:29 +02:00
Tomas Hozza
c07cbb2de4 osbuild1: support VMDK subformat in QEMU assembler
Related to https://github.com/osbuild/osbuild/pull/1000
2022-05-04 16:22:29 +02:00
Ondřej Budai
8575620591 distro: add an alias for rhel-91
We would benefit from having support for 9.1 downstream so let's add it in
the form of an alias. This is a bare minimum for having a proper 9.1 support.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-03 18:13:28 +02:00
Ondřej Budai
6fce34a5ea worker: add proxy support to composer and oauth calls
In the internal deployment, we want to talk with composer over a http/https
proxy. This proxy adds new composer.proxy field to the worker config that
causes the worker to connect to composer and the oauth server using
a specified proxy.

NB: The proxy is not supported when connection to composer via unix sockets.

For testing this, I added a small HTTP proxy implementation, pls don't
use this in production, it's just good enough for tests.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-03 06:19:31 +01:00
Ondřej Budai
9ee3997428 worker: use custom requester also for oauth refresh
Just so we can share e.g. proxy server or other http transport settings.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-03 06:19:31 +01:00
Ondřej Budai
71a4ceecaa worker/client: factor out common testing code
Just so we don't need to care about all the server-side setup in individual
test cases and we can just reuse the setup.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-03 06:19:31 +01:00
Ondřej Budai
b4d6ec5a75 worker/client: simplify the oauth test
Firstly, let's use t.TempDir(), it's less code.

Secondly, let's remove all the code that touches distributions, we can just
use random values, both worker server and client actually do't inspect
any values so they can be completely random.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-03 06:19:31 +01:00
Ondřej Budai
ed8bcd2f49 worker: move client test to its own file
This test actually verifies that the client code for OAuth works. As this was
the only code that tests client in the file, I think it deserves its own one.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-03 06:19:31 +01:00
Christian Kellner
98b491fcac distro/rhel85: 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.
Add "lvm2" to the build pipeline and thus generate new manifests
and image infos.
Adjust the existing tests that assumed we can not create more
than 4 partitions on mbr layouts, since that is now not true
anymore.
This is a port from rhel86, commit 63aa155

The change in osPipeline() is required now to fix the Prefix for the
bootloader specification when LVM is used. The unspecified Prefix, which
was previously used for all cases, defaults to "/boot". When the layout
is converted to LVM, a boot partition is created and the BLS Prefix
should be set to "".

In the case where we don't have a partition table, the BLS stage is not
needed, but it was done unconditionally before, so keep the default
image definitions unchanged.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-04-30 12:37:50 +01:00
Christian Kellner
bd6b8e7128 distro/rhel85: reformat distro build package list
One package on each line, makes future changes easier to follow.
No actual change of packages in this commit.
2022-04-30 12:37:50 +01:00
Tomas Hozza
01864e4db7 Don't support gce-rhui image type on CentOS Stream 8
The RHUI variant of the GCE image is intended only for RHEL.
2022-04-29 09:24:40 +02:00
Achilleas Koutsou
8be2c5c89a disk: test minimum directory size calculations
/ and /usr have minimum sizes defined (1 GiB and 2 GiB respectively).
When /usr is not defined, the minimum size of /usr gets added to the
minimum size for /.
This new test runs through a few scenarios and checks whether the sizes
fit.
2022-04-29 08:55:36 +02:00
Achilleas Koutsou
b8cd4bb839 disk: add an empty blueprint to the tests
Adjusted tests accordingly
2022-04-29 08:55:36 +02:00
Achilleas Koutsou
ae9960b8db disk: test that all mountpoints are the minimum 1 GiB
This tests that the clampFSSize() function ensures all user-defined
mountpoints are at least 1 GiB.
Added a blueprint with < 1 GiB minsizes to test this.
Testing all blueprints in TestCreatePartitionTable() now.
2022-04-29 08:55:36 +02:00
Achilleas Koutsou
61be84d634 disk: define blueprint map for test
Convenient for iterating and to define more cases.
2022-04-29 08:55:36 +02:00
Achilleas Koutsou
9920d798f5 disk: remove special case for /usr in clampFSSize
The `/usr` case is now handled by the `EnsureDirectorySizes()` function.
2022-04-29 08:55:36 +02:00
Achilleas Koutsou
275e60f199 disk: add default minimum directory sizes
Currently, we only specify a minimum size for
- `/` (1 GiB), and
- `/usr` (2 GiB).

This ensures that
- a separate `/usr` partition is at least 2 GiB,
- `/` is always at least 1 GiB,
- if `/usr` it not a separate partition, `/` is at least 3 GiB.

We could (or should), in the future, make it possible for image types to
override this mapping as part of their default config, for example, if
an image type by default requires a larger `/usr`.
2022-04-29 08:55:36 +02:00
Achilleas Koutsou
efa10e56e1 disk: use constants for size units in tests
Makes the test values more readable (without needing comments).
Some values in the default partition table were fixed, e.g., cases where
we had `Size: 1024000, // 500 MB`.
2022-04-29 08:55:36 +02:00
Christian Kellner
b365b18390 disk: fix ensureLVM for partition tables without /boot
When the partition table did not have a boot partition, we created it
but then _unconditionally_ returned, which meant that we did not create
the LVM skeleton and wrap the root partition. Properly handle this case
and also re-initialize the `rootPath` in this case since we change the
underlying `Partition[]` array in `PartitionTable` object. Add an extra
blueprint with only one customization which exposes this bug.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-04-29 08:55:36 +02:00
Tomas Hozza
81fc032a45 RHEL-90: don't pass blueprint package set separately to pipelines
Blueprint package set is now depsolved together with the OS package set
in a chain. The result is stored in the package specs sets under the OS
package set name.

In reality, the code was able to handle a `nil` package specs to be
passed to pipelines, however some parts were looking for the kernel
version in the blueprint package specs, which would be a bug.

Regenerated affected image test cases.
2022-04-28 14:42:49 +02:00
Tomas Hozza
e6a20699f9 RHEL-90beta: don't pass blueprint package set separately to pipelines
Blueprint package set is now depsolved together with the OS package set
in a chain. The result is stored in the package specs sets under the OS
package set name.

In reality, the code was able to handle a `nil` package specs to be
passed to pipelines, however some parts were looking for the kernel
version in the blueprint package specs, which would be a bug.

Regenerated affected image test cases.
2022-04-28 14:42:49 +02:00
Tomas Hozza
c26a1839d1 RHEL-86: don't pass blueprint package set separately to pipelines
Blueprint package set is now depsolved together with the OS package set
in a chain. The result is stored in the package specs sets under the OS
package set name.

In reality, the code was able to handle a `nil` package specs to be
passed to pipelines, however some parts were looking for the kernel
version in the blueprint package specs, which would be a bug.

Regenerated affected image test cases.
2022-04-28 14:42:49 +02:00
Tomas Hozza
4c707663f2 RHEL-85: don't pass blueprint package set separately to pipelines
Blueprint package set is now depsolved together with the OS package set
in a chain. The result is stored in the package specs sets under the OS
package set name.

In reality, the code was able to handle a `nil` package specs to be
passed to pipelines, however some parts were looking for the kernel
version in the blueprint package specs, which would be a bug.

Regenerated affected image test cases.
2022-04-28 14:42:49 +02:00
Tomas Hozza
800ac5fe0b Weldr: use rpmmd.DepsolvePackageSets() in compose handler
Use `rpmmd.DepsolvePackageSets()` in Weldr API compose request handler,
instead of `rpmmd.Depsolve()`.

Extract common code from `API.allRepositories()` and
`API.allRepositoriesByImageType()` to a new method
`API.payloadRepositories()`.

Modify `API.allRepositoriesByImageType()` to return payload repositories
(repositories defined by user) as a separate slice to enable the use of
`rpmmd.DepsolvePackageSets()`, which requires the package-set-specific
repositories to be passed separately.

Keep using `rpmmd.Depsolve()` in Weldr where appropriate. The
implementation depsolves various simple package sets for multiple API
request handlers and it does not make sense to complicate the code by
moving to `rpmmd.DepsolvePackageSets()`.
2022-04-28 14:42:49 +02:00
Tomas Hozza
21c6c452ef TestDistro: return dummy values from PackageSets related methods
Return dummy values from the following methods:
 - PackageSets
 - PayloadPackageSets
 - PackageSetsChains

Use package set names commonly used by recent distro definitions.
Package sets are based on values used by rpmmd mock implementation.

Adjust two Weldr API unit test check for the dummy values. Without
this fix, these unit tests would start failing after the move to
`rpmmd.DepsolvePackageSets()` in Weldr API compose handler.
2022-04-28 14:42:49 +02:00
Tomas Hozza
42b3512b12 Delete TestImageType methods not required by ImageType interface 2022-04-28 14:42:49 +02:00
Tomas Hozza
b92196a056 kojiapi: use DepsolvePackageSets instead of Depsolve 2022-04-28 14:42:49 +02:00
Tomas Hozza
694230b453 TestDistro_Manifest: use DepsolvePackageSets instead of Depsolve 2022-04-28 14:42:49 +02:00
Tomas Hozza
e819e08098 worker: extend the depsolve job to use DepsolvePackageSets()
Extend the `DepsolveJob` worker job argument to contain package sets
chains and use `DepsolvePackageSets()` for depsolving.
2022-04-28 14:42:49 +02:00
Tomas Hozza
ef4db9edda rpmmd: introduce DepsolvePackageSets() to the RPMMD interface
Add a convenience method `DepsolvePackageSets()` to the `RPMMD`
interface. The method is expected to depsolve all provided package sets
in a chain or separately, based on the provided arguments, and return
depsolved PackageSpecs sets.

The intention is to have a single implementation of how are package sets
depsolved and then use it from all places in composer (API and tools
implementations).

Adjust necessary mock implementations and add a unit test testing the
new interface method implementation.
2022-04-28 14:42:49 +02:00
Tomas Hozza
fee529cd0a distro: introduce PackageSetsChains() method to ImageType
Introduce a new method `PackageSetsChains()` to the `ImageType`
interface, which returns a named lists of package sets, which should be
depolved together in a chain.

Extend all distro implementations with the new method.

Add a unit test ensuring that if an image type defines some package set
name chains, that all of the listed package set names are present in the
package set map returned by the image type.

The method is currently not used anywhere. This is a preparation for
switching from current way of depsolving to the chain depsolving.
2022-04-28 14:42:49 +02:00
Tomas Hozza
04d45a0fce rpmmd: switch Depsolve() internal implementation to chainDepsolve()
Replace the `rpmmdImpl.Depsolve()` internal implementation by a call to
`rpmmdImpl.chainDepsolve()`.
2022-04-28 14:42:49 +02:00
Tomas Hozza
d48da99a12 rpmmd/dnf-json: support chain dependency solving
Add a new `rpmmdImpl` method `chainDepsolve`, which is able to
depsolve multiple chained package sets as separate DNF transactions
layered on top of each other.

This new method allows to depsolve the `blueprint` package set on top of
the base image package set (usually called `packages`).

Introduce a helper function `chainPackageSets` for constructing
arguments to the `chainDepsolve` method based on the provided arguments:
 - slice of package set names to chain as transactions
 - map of package sets
 - slice of system repositories used by all package sets
 - map of package-set-specific repositories

Extend `dnf-json` with a new command `chain-depsolve` allowing to
depsolve multiple transaction in a row, layered on top of each other.

Add unit tests where appropriate.
2022-04-28 14:42:49 +02:00
Achilleas Koutsou
55a2e8ddac disk: add function for resizing Entities based on dirs
New function that ensures that a partition can hold the total sum of all
the required sizes of specific directories on the partition.  The
function sums the required directory sizes grouped by their mountpoint
and then resizes the entity path of that Mountable.
2022-04-27 13:49:19 +02:00
Achilleas Koutsou
ce5a28c113 disk: add function for finding entity path for a dir
New function that returns the Entity path for the Mountpoint that
contains a given directory path.
2022-04-27 13:49:19 +02:00
Achilleas Koutsou
75a0a74064 disk: add docstring for resizeEntityBranch()
resizeEntityBranch() is a private function, but it's not immediately
clear how it works so a docstring is useful for internal development.
2022-04-27 13:49:19 +02:00
Achilleas Koutsou
2b2181867f osbuild2: use source-array-ref for rpm stage inputs
The (new) source-array-ref object is an array of objects, which allows
for input references to have options (metadata) but still maintain their
order when (de)serialised.

Fixes https://github.com/osbuild/osbuild-composer/issues/2577
Related to https://github.com/osbuild/osbuild/pull/1003
2022-04-27 11:51:25 +02:00
Achilleas Koutsou
26a83262a8 osbuild2: new references format for rpm stage inputs 2022-04-27 11:51:25 +02:00
Achilleas Koutsou
b277d88d93 osbuild2: rename RPMStageReferenes to RPMStageSourceOptions
Matches the equivalent object reference in the osbuild schema:
org.osbuild.files/definitions/source-options
2022-04-27 11:51:25 +02:00
Achilleas Koutsou
0a695b21a1 osbuild2: add some docstrings for rpm input types
A few simple docstrings for the RPM input structs.
2022-04-27 11:51:25 +02:00
Sanne Raymaekers
e258947a58 cloudapi/v2: Fix generated GCP name
The generated gcp name had an invalid `.tar.gz` extension. This
extension still needs to be supplied for the object name however.

The integration tests supply the image name rather than relying in the
generated one, which is why this slipped through.
2022-04-26 13:58:54 +02:00
Tomas Hozza
013eb6c9af RHEL-86/EC2 SAP: install ansible-core instead of ansible
Related to https://bugzilla.redhat.com/show_bug.cgi?id=2077356
2022-04-21 16:20:50 +02:00
Tomas Hozza
d474db38d5 RHEL-86/EC2 SAP: install compat-sap-c++-10
Related to https://bugzilla.redhat.com/show_bug.cgi?id=2074114
2022-04-21 16:20:50 +02:00
Tomas Hozza
082ce34a93 RHEL-90/EC2 SAP: install @Server package group
Related to:
- 9.0: https://bugzilla.redhat.com/show_bug.cgi?id=2076763
- 9.2: https://bugzilla.redhat.com/show_bug.cgi?id=2076761
2022-04-21 16:20:50 +02:00
Tomas Hozza
54ba98f8c1 RHEL-86/EC2 SAP: install @Server package group
Related to https://bugzilla.redhat.com/show_bug.cgi?id=2074107
2022-04-21 16:20:50 +02:00
Tomas Hozza
4bba54b1b3 RHEL-90/EC2 SAP: adjust PAM limits configuration
Related to:
- 9.0: https://bugzilla.redhat.com/show_bug.cgi?id=2076759
- 9.2: https://bugzilla.redhat.com/show_bug.cgi?id=2076760
2022-04-21 16:20:50 +02:00