Commit graph

1171 commits

Author SHA1 Message Date
Tomas Hozza
b150d57c18 Weldr API: make Image Type denylist distribution-specific
Change the Image Type denylist in Weldr API from being applied to all
distributions to being distribution-specific. A special name `*`
can be used in the configuration to match any distribution
or any image type.

Modify NEWS entry and unit tests to reflect this change.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 18:51:03 +02:00
Tomas Hozza
076bbc5456 Weldr API: introduce Image Type denylist for filtering exposed images
Extend Weldr API to accept a list of denied image types, which should
not be exposed via API for any supported distribution. This
functionality will be needed to not expose image types which can't be
successfully built outside of Red Hat VPN. Example of such images are
the official RHEL EC2 images, which include RHUI client packages not
available publicly.

Image Types are filters when listing available compose types and
creating a new compose using Weldr API.

Extend osbuild-composer configuration to allow specifying the list of
denied Image Types for Weldr API.

Add unit tests for implemented changes.

Add NEWS entry describing the newly introduced functionality.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 18:51:03 +02:00
Achilleas Koutsou
51cb4ae043 distro/rhel85: move selinux stage to last
In the main OS pipeline created by osPipeline(), there is often a set of
stages that are added after the common ones. The SELinux stage must
always be last in the pipeline, so it is added externally by the calling
function.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-07-29 16:45:20 +02:00
Achilleas Koutsou
daae2bbfca distro/rhel85: set build root for main os pipeline
OS image tree was being built on the host instead.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-07-29 16:45:20 +02:00
Lars Karlitski
9c2c92f729 jobqueue: Introduce jobqueue backed by a postgres database
Co-authored-by: sanne <sanne.raymaekers@gmail.com>
2021-07-28 21:52:31 +01:00
Lars Karlitski
871c6e9cbb fsjobqueue: make canceling a finished job an error
This mirrors FinishJob(), which also errors when the job is already
finished.
2021-07-28 21:52:31 +01:00
Lars Karlitski
30492bfc60 jobqueue: move fsjobqueue's generic tests into new package
fsjobqueue_test contained tests that are generically testing the
JobQueue interface. Split those out into its own package `jobqueuetest`.

These tests will be useful when implementing a new package that conforms
to the JobQueue interface.
2021-07-28 21:52:31 +01:00
Gianluca Zuccarelli
bf62f3868e weldr: add filesystem configuration support 2021-07-28 21:44:03 +01:00
Gianluca Zuccarelli
fa15541ea5 blueprint: test minsize and sector-size validation 2021-07-28 21:44:03 +01:00
Gianluca Zuccarelli
90733e79f3 blueprint: add filesystem minsize function 2021-07-28 21:44:03 +01:00
Gianluca Zuccarelli
7408be580c client: test supported and unsupported mountpoints 2021-07-28 21:44:03 +01:00
Gianluca Zuccarelli
c671a0dab1 distro: test filesystem errors 2021-07-28 21:44:03 +01:00
Gianluca Zuccarelli
f4ee0bfabf distro: add root filesystem support 2021-07-28 21:44:03 +01:00
Gianluca Zuccarelli
d0e4558b2b blueprint: add filesystem customisations support 2021-07-28 21:44:03 +01:00
Thomas Lavocat
4729990ac0
cloudapi: Add User customization
Cloud api now exposes user customization that let a customer able to add
a new user with a set of groups and a ssh key.

Testing:
* adds 2 users to the AWS image, accessible with a temp ssh key.
* the first one is in the group wheel, the other is not

Fixes #1574
2021-07-28 10:40:25 +02:00
Achilleas Koutsou
9bb2ae09bd distro/rhel85: fix pkg set for grub2 stage
The package set is needed by the GRUB 2 stage options function to find
the Kernel package in order to add the saved entry option. The Kernel
package is defined in the blueprints package set, not the OS package
set.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-07-27 16:53:24 +01:00
Martin Sehnoutka
b950d6e062 weldr: accept rhsm parameter in sources
The system sources allow specification of the rhsm parameter, but it
isn't available in the sources configured over the Weldr API. This patch
implements support for it.
2021-07-27 15:39:36 +02:00
Tomas Hozza
928131003c osbuild2: fix incorrect function name in dracut.conf stage
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
cdc65f82da osbuild2: extract unit drop-ins from systemd -> systemd.unit
The part creating Systemd unit drop-ins was extracted from
`org.osbuild.systemd` stage to `org.osbuild.systemd.unit`,
before the osbuild v30 release. Update the composer implementation
to reflect the change.

Related to https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
49aebf1c68 osbuild2: change systemd-logind stage to match osbuild v30
The `org.osbuild.systemd-logind` stage was reworked before the osbuild
v30 release. Update the composer implementation to match the expected
schema.

Related to https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
6cd626d462 osbuild2: change dracut.conf stage to match osbuild v30
The `org.osbuild.dracut.conf` stage was reworked before the osbuild v30
release. Update the composer implementation to match the expected
schema.

Related to https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
b56642d6dd osbuild2: change modprobe stage to match osbuild v30
The `org.osbuild.modprobe` stage was reworked before the osbuild v30
release. Update the composer implementation to match the expected
schema.

Related to https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
d4de95ab5a osbuild2: change cloud-init stage to match osbuild v30
The `org.osbuild.cloud-init` stage was reworked before the osbuild v30
release. Update the composer implementation to match the expected
schema.

Related to https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Achilleas Koutsou
74d61b9ae2 distro/rhel85: fix edge-installer build packages
The edge-installer build root requires the installer build package set.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
e0178bd76e distro/rhel85: add kernel to main OS package set
If there's no kernel in the main package set, the standard/default
kernel will be added while depsolving. This causes issues when an
alternative kernel is selected in the blueprint. Both kernels will be
installed (one from the blueprint and one from the main OS set) which
causes issues with ostree image types.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
fe1ed9f869 distro/rhel85: remove broken arch-imgType combo check
The specific combination isn't broken in RHEL 8.5. The condition check
was added accidentally when copying the tests from RHEL 8.4.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
347fcf74a6 osbuild2: base device options are optional 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
2b558e49ab distro/rhel85: init mounts array to 0 elements
Since partitions without a filesystem are skipped, we need to
dynamically append to create the mounts array instead of pre-allocating
to the number of partitions.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
6313532c90 distro/rhel85: add blueprint pkgs to ostree pipeline
Blueprint packages are now defined and passed into Manifest()
separately. The main osPipelines() already has an argument for
explicitly passing the blueprint packages. Added the same for the ostree
pipelines.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
4048383e07 distro/rhel85: package set key consts in pipelines
Use the package set key constants defined in distro in the pipeline
definitions as well.
2021-07-24 15:54:00 +02:00
Ondřej Budai
57e8ca0e5f distro/rhel85: sort mounts
Previously, /boot/efi mount was specified before /. This obviously doesn't
work because we need to mount / firstly.

This commit adds explicit ordering of the mounts.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Ondřej Budai
c656972f25 osbuild2: specify mounts as an array
osbuild has recently got support for specifying mounts as an array. This
commit takes advantage of it and uses this new format.

This allows us to specify the order of mounts which is important because
we cannot mount /boot/efi before / is mounted.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Tomas Hozza
3a2415d970 distro/rhel85: add image type aliases for EDGE image types
EDGE image types are defined under a different name for RHEL-8.5,
specifically they don't contain the "rhel-" prefix any more. To ensure
backward compatibility, add image type aliases for all EDGE image types
with the "rhel-" prefix.

Image type aliases are used only when getting a specific imageType
instance by its name. When listing all available image types for an
architecture, only the current image type names are returned, without
any aliases. This prevents the image types from being exposed multiple
times under different names via Weldr API.

Extend the distro unit tests to test image type aliases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-24 15:54:00 +02:00
Tomas Hozza
b3cb01cea4 distro/rhel85: refactor TestFilenameFromType test
Refactor data structures used for test cases in the
`TestFilenameFromType()` to have more descriptive names.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-24 15:54:00 +02:00
Tomas Hozza
e45e117a0b distro/rhel85: don't copy architecture when adding it to a distro
Originally, a copy of an architecture instance was always created when it
was added to a distro definition using the `addArches()` method.
However in reality, only a subset of structure members were copied,
which could create unexpected behavior and issues. This behavior is
identical to the behavior when image types are added to an architecture.
However the situation with image types differs in one aspect,
specifically that a single image type definition is usually reused
by multiple architecture definitions, while an architecture definition
is always used only by a single distribution definition.
Due to the fact that the image type contains a reference to the
architecture to which it has been added, the creation of a copy can not
be reasonably avoided. On the other hand, adding a copy of an architecture
to a distribution definition is not necessary.

Downside of creating copies of the architecture is that the image types
associated with it referred always to the original architecture
definition instance and not to the copy. So while references in the
direction of Distro -> Arch -> Image Type were correct and working, the
other direction was broken. Image Type -> (original) Arch -> (nil)
Distro.

Modify `distribution.AddArches()` method to directly add the passed
architecture instances to the distribution definition, instead of adding
their copies.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-24 15:54:00 +02:00
Ondřej Budai
985dbcfeec distro/rhel85: handle subscriptions only once in the pipeline
Previously, the first boot stage was added twice if the subscription
customization was enabled. This doesn't work because the first boot stage
cannot be specified twice in one pipeline. Also, it didn't make much sense
because it just duplicated the effort so I just removed one of the two stages.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Ondřej Budai
d1da221a8c distro/rhel85: fix name of exported pipeline
it's actually vpc, not vhd

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
8d64cb9665 distro/rhel85: const strings for package set keys
const string keys make the names easier to reuse or change and is less
error prone.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
5909ca202d disk: boot partition finder as partitiontable method
Moved the function that searches for the boot partition index to the
PartitionTable struct as a method. The method returns -1 if not found
and it's now the responsibility of the caller to handle the case where
it is not found.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
bc1b45f7fa qemu stage test squash 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
ce0fddf4c2 osbuild2: unit tests for new stages 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
dc62275d4d common: helper function for uint64 ptr 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
cba720e63f rhel85: depsolve blueprint packages separately
To avoid packages specified in a blueprint from conflicting with exclude
lists, we depsolve blueprint packages separately and pass them into the
Manifest generator under the new "blueprint" package set key.

This approach has the added benefit that dependencies of packages
specified in the blueprint are not subject to exclusion in addition to
the explicitly named packages.

The OS pipeline which installs the packages for the base system merges
the two package sets before running the RPM stage. The signature of the
function is changed to explicitly require blueprint packages be
specified (though `nil` or empty slice is valid).

The kernel selection test is adapted to merge the package sets before
counting kernel package.

Adaptation of changes in
https://github.com/osbuild/osbuild-composer/pull/1349
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
190f473b04 distro/rhel85: update unit tests 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
d6ec5aa59e distro/rhel85: update ami package set
Based on http://git.app.eng.bos.redhat.com/git/spin-kickstarts.git/tree/rhel8/rhel-8.5-ec2.ks
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
b8d34d7679 distro/rhel85: introduce the ami image type
This is a copy of the ami image type from RHEL 8.4.
Small modifications are necessary.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
1f005a55b9 distro/rhel85: don't always install bootloader
Don't install bootloader unless `platform` (imageType.arch.legacy) is
defined.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
9c3c956655 distro/rhel85: aarch64 uefi: true 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
3f0f4ffab9 distro/rhel85: simplify edge types and package sets
- Cleaned up distro-specific edge package sets
- Added edge package set merging in PackageSets() function
- Edge image type definitions are no longer arch specific, just like the
  other image types
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
78920efc36 distro/rhel85: partition table fixes
- Automatically find /boot partition (fallback to root)
- Partition sizes need a bit of a shrink
2021-07-24 15:54:00 +02:00