Commit graph

1937 commits

Author SHA1 Message Date
Ondřej Budai
de46e85712 cloudapi: make Repository.rhsm optional
I think that we can spare the users of clouadpi of writing "rhsm": "false"
into the requests so I decided to make this property optional and default
to false.

This is nice because it matches the behaviour of Weldr repositories and
sources so we can also use test/data/repositories without any changes after
openapi validation is enabled.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-05-11 13:46:47 +02:00
Jordi Gil
616258ee25 distro: housekeeping with cpu arch and arch.Name() 2022-05-10 19:53:41 +02:00
Jordi Gil
b6f61d26ea distro/fedora: extend kernel options for openstack, qcow2, vhd and vmdk types
* Use the same value from AMI to these image types:

"ro no_timer_check console=ttyS0,115200n8 biosdevname=0 net.ifnames=0"

* Regenerate manifests
2022-05-09 12:25:21 +02:00
Jordi Gil
69095f5034 distro/fedora: produce VMDK as stream-optimized
Added code in fedora/pipelines.go to add the subformat field in the
manifests

Added manifests for f34 and f35 for x86_64 only (image type not
available in aarch64)
2022-05-09 12:25:21 +02:00
Jordi Gil
0c3d17983b distro/fedora: Added package 'fedora-release-iot' for iot-commit image type 2022-05-09 12:25:21 +02:00
Jordi Gil
f256303854 distro/fedora: Changed kernelOptions value for ec2/ami image to be ro no_timer_check console=ttyS0,115200n8 biosdevname=0 net.ifnames=0 2022-05-09 12:25:21 +02:00
Jordi Gil
7cf937d668 distro/fedora: removed specific locale and timezone for ec2/ami since they are the same as the default one for all image types 2022-05-09 12:25:21 +02:00
Jordi Gil
6d89a0f333 distro/fedora: change default target for qcow2,oci,vhd image types to multi-user instead of graphical 2022-05-09 12:25:21 +02:00
Jordi Gil
dbd163d49c distro/fedora: use GetTestingImagePackageSpecSets() and remove references to "centos" 2022-05-09 12:25:21 +02:00
Jordi Gil
5936abf85e distro/fedora: refactor osBuild pipeline 2022-05-09 12:25:21 +02:00
Jordi Gil
9a4125a37d distro/fedora: Added packageSetChain references
* Removed specific function that packaged the fedora cloud package group to avoid collision between fedora-identity-cloud and fedora-identity-basic packages. With the introduction of the PackageSetChains() it is no longer necessary to filter the packages
2022-05-09 12:25:21 +02:00
Jordi Gil
426085c060 distro/fedora: added smartmontools-selinux for iot commit 2022-05-09 12:25:21 +02:00
Jordi Gil
40d5950f1e distro/fedora: Set default target for ami/ec2 image type to multi-user and remove extra console entry in kernel opts 2022-05-09 12:25:21 +02:00
Jordi Gil
1d0e5c3410 distro/fedora: changed x86_64 bootType to hybrid 2022-05-09 12:25:21 +02:00
Jordi Gil
96d9e63b77 distro/fedora: capitalized IoT in fedora 2022-05-09 12:25:21 +02:00
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