Commit graph

512 commits

Author SHA1 Message Date
Christian Kellner
79c6e65976 stages/logind: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
9f1d97a8b7 stages/modprobe: write only one config file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify additional options at the top level which
will then be per-file, like a top level comment.
2021-07-22 01:05:29 +02:00
Christian Kellner
0190c991ae stages/dracut: write only one config file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify additional options at the top level which
will then be per-file, like a top-level comment.
2021-07-22 01:05:29 +02:00
Christian Kellner
a1703dc298 stages/cloud-init: write only one config file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify the directory, `/etc` vs `/usr` via a new
top level `directory` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
0becf66454 stages/dracut.conf: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
f259b4e5ca stages/modprobe: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
9e259ae0bc stages/cloud-init: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Diaa Sami
8be74157ae test: fix wrongly named class
The test class for the v2 tests was wrongly named `TestFormatV1`.
2021-07-21 16:46:09 +02:00
Christian Kellner
0cab954d84 test/fmt_v2: more tests for mounts
Add tests for the duplicate mount, missing device detection.
2021-07-21 13:28:22 +02:00
Christian Kellner
3965291895 test/fmt_v2: include devices and mount
Include devices and mounts in the basic pipeline to check that
parsing and describing them works as expected.
2021-07-21 13:28:22 +02:00
Christian Kellner
ae1296e33a formats/v2: mounts are arrays
The order of entries in a dictionary is not specified by the JSON
standard and hard to control when marshalling dictionaries in Go.
Since the order of mounts is important and the wrong order leads
to wrong mount trees change the `mounts` field to an array. This
breaks existing manifests but after careful deliberation it was
concluded that the original schema with mounts as dictionaries
is not something we want to support. Apologies to everyone.

Adjust the schema of the copy and zipl stage accordingly.
2021-07-21 13:28:22 +02:00
Diaa Sami
02ceb02d2a osbuild: Add validation for source references
Validate source references while loading manifests so that a bad
reference would result in a meaningful error message instead of a
hard-to-understand Python exception.
2021-07-20 20:22:27 +02:00
Christian Kellner
bd8cd7443a test/data: split up the bootiso stage
Use the new `squashfs`, `grub2.iso` and `isolinux` stage to re-
plicate what the `bootiso.mono` stage was doing, which is now
considered deprecated.
2021-07-16 15:19:58 +01:00
Christian Kellner
e8bf211e0c test/data: move ostree repo to the iso root
Instead of having the OSTree repo in the anaconda root squashfs,
put the it to the root of the iso. This has several advantages:
first and foremost, we don't have to make a huge squahfs file-
system. We don't have to compress the repo. Additionally, the
repo is now easily accessible by mounting the iso.
2021-07-15 23:08:51 +01:00
Christian Kellner
a19e261dbe test/data: move kickstart to the iso root
Intead of overwriting the standard ananconda kickstart file, we
move it to the root of the iso. To have anaconda pick it up an
additional kernel command line parameter is required.
2021-07-15 23:08:51 +01:00
Christian Kellner
c77170a924 test/data: create core user via kickstart
Create the users via the new users support that was added to the
kickstart stage, instead of having them in the OSTree commit.
2021-07-15 23:08:51 +01:00
Christian Kellner
9d3c420a38 test/data: update x11 pkgs for ostree-bootiso
F34+ has the xorg-x11-server-utils package split up. Install the
individual new packages we need for anaconda.

See Anaconda commit 55371c996861a47da9504b31118858dd3257a8b0
2021-07-15 23:08:51 +01:00
Tomas Hozza
7617cb9a44 stages/authselect: rename profile_id option to profile
Rename the `profile_id` option to `profile` in the stage schema. This is
a follow-up to PR#696 comment after is has been merged [1].

[1] https://github.com/osbuild/osbuild/pull/696#discussion_r661253293

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-15 17:17:50 +02:00
Christian Kellner
cc39d5a8b4 test/data: use more variables in ostree-bootiso
Use variables for various often occuring contants, like the
release, ref and isolabel. Additionally, use variables for
the snapshot so it can be changed easily.
2021-07-14 23:51:34 +02:00
Christian Kellner
a9b3fbd92b test/data: auto-format ostree-bootiso
Re-indent and format the bootiso mpp. No actual content changes.
2021-07-14 23:51:34 +02:00
Christian Kellner
c4db24c481 tools/mpp: substitute vars in mpp blocks
Allow the manifest variables, defined via mpp-vars, to be used from
within the mpp blocks. For this template strings are used, where
variables are marked via `$`. We cannot use the `mpp-format` logic
easily there, since that is processed after other mpp directives
have been processed.
As a result remove the built-in substitution from support from dnf
dep-solving, since we had to post-process the resulting urls with
variable substitution afterwards. Now that is covered with this
more generic mechanism.
2021-07-14 23:51:34 +02:00
Christian Kellner
c774e76079 test/data: remove duplicated baseurl entries
We don't need to define them twice, remove them everwhere where
that was the case.
2021-07-14 23:51:34 +02:00
Javier Martinez Canillas
6901c4dfc5 test/data: use UTF-8 locale on all manifests
The manifests set a "en_US" locale but this causes gnome-terminal to not
run due a non UTF-8 locale being used, which is an unsupported config:

gnome-terminal-server[1899]: Non UTF-8 locale (ISO-8859-1) is not supported!

Reported-by: Stephen Smoogen <ssmoogen@redhat.com>
2021-07-14 23:50:24 +02:00
Christian Kellner
d09f07a24c test/data: remove users from ostree-image
Let's not have users in the ostree commit itself since we have
zezere ignition enabled for user provisioning.
2021-07-12 18:21:05 +02:00
Christian Kellner
284e73a018 test/data: enable greenboot and zezere ignition
Enable greenboot for health checks and zezere ignition so we get
user provisioning like Fedora IoT. Also explicitly opt into rngd
and sshd.
2021-07-12 18:21:05 +02:00
Christian Kellner
75e3856967 test/data: use new ostree stages
Use the new ostree stages instead of the old monolithic one.
2021-07-12 18:21:05 +02:00
Christian Kellner
368d0a5c18 tools/mpp: support multiple image definitions
Support more than one image definition by introducing a `id` attribute
which can be used to specify how the variable for the definition is
called.
2021-07-09 19:50:38 +01:00
Christian Kellner
d2c4888843 test/data: use mpp-define-image in ostree-image
Use the new partiton layout support in MPP. NB: start data as
well as the size of the last partition have been omitted now,
since `sfdisk` will figure those out for us.
2021-07-08 22:47:45 +02:00
Christian Kellner
4456e1f276 stages: add org.osbuild.mkdir
Can create one or more directories, optionally also their parents.
Add some basic tests as well.
2021-07-08 21:14:21 +01:00
Christian Kellner
254c1cd9fb api: remove host side arguments facility
Now that arguments are transmitted via a mapped, i.e. bind-mounted,
file instead of using the jsoncomm RPC mechanism, all the methods
related to the latter can be removed from API.
2021-07-08 15:01:33 +01:00
Christian Kellner
82d33a35ae api: remove unused 'monitor' parameter
The monitor parameter, which previously was used for stream logs
to via the output handling of API, is now no longer needed. Thus,
it can be removed.
2021-07-08 15:01:33 +01:00
Christian Kellner
1dc845f331 tools/mpp: properly support substitutions
Previous versions of mpp would already set the arch and basearch
substitution, which would work for dep-solving itself, but not
properly re-write the resulting URLs which means that the manifest
was broken. Fix this by properly replacing the substitutions in
the URL. Also support official 'releasever' substitution.
2021-07-07 15:10:00 +02:00
Paul Wayper
6ee1bb93dd Reformat other subprocess.run commands to highlight command
Signed-off-by: Paul Wayper <paulway@redhat.com>
2021-07-02 11:38:02 +01:00
Paul Wayper
6d0054826b Trivial formatting change to test public contribution system
Signed-off-by: Paul Wayper <paulway@redhat.com>
2021-07-02 11:38:02 +01:00
Christian Kellner
d47f735112 tools/mpp: create PkgInfo class for package info
Instead of passing dictionaries around that are inconvenient to
use in code and even more in the `mpp-format-*` directives, use
a simple class to represent package information. Use that in
the `pkginfo` dict that can be accessed via `mpp-format-*`. Use
the `evra` property instead of string manipulation in the
`fedora-boot.mpp.json` and `-ostree-bootiso.mpp.json` manifest.
2021-07-02 11:28:43 +02:00
Christian Kellner
d5c5947271 test/data: generate the fff... uuid
Instead of writing 32 `f` chars, we can now generate it. The
future is here.
2021-07-02 11:28:43 +02:00
Christian Kellner
8a27de0d10 tools/osbuild-mpp: include nevra in package list
Include the nevra in the list of dep-solved packages. Use that for the
package info. Adapt the boot manifest accordingly.
2021-07-02 11:28:43 +02:00
Alexander Larsson
e4eb3e0fd0 Use the new formating features to simplify the test manifests
This uses size computations to simplify the partition size/offsets
and the depsolv results to get the kernel version.

This makes no changes to the resulting json files.
2021-07-01 15:06:57 +02:00
Achilleas Koutsou
ba3467d747 test/data: update nginx.conf manifests
- Update to v2 manifest
- Add build stage
2021-07-01 10:49:38 +02:00
Achilleas Koutsou
7e1f2fa9b9 test/data: update chmod manifests
- Update to v2 manifest
- Add build stage
- Create file from inline data and use it for testing chmod
2021-07-01 10:49:38 +02:00
Christian Kellner
3ab543937c test/stages: include checks for the xz stage
Compress a file, delivered via the inline source, and check it exists.
2021-06-30 12:06:30 +02:00
Christian Kellner
427266c583 test: support v2 format for tree-id detection
In the function `treeid_from_manifest`, use dynamic format detection
instead of hard-coding the use of the version 1 format. Additionally,
directly access the `tree` pipeline and its `id` instead of going
via the `get_ids` helper function, which is only present in v1.py.
2021-06-30 12:06:30 +02:00
Tomas Hozza
88da3beabc stages/authselect: new stage to select system identity and auth sources
Add a new `org.osbuild.authselect` stage for configuring system identity
and authentication sources using `authselect`. The stage runs
`authselect select` command from the image in a chroot to set the
desired 'profile_id' profile. Optionally, a list of specific profile
features to enable can be passed using the 'features' option.

Add a test case for the new stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-30 09:17:08 +02:00
Tomas Hozza
6140ba1130 stages/keymap: add option to configure X11 keyboard
Add a new option 'x11-keymap' for configuring the X11 keyboard settings.
The value of the option is a dictionary with keys representing settings
which can be configured. Currently, only the 'layouts' setting can be
configured. Its value is a list of strings, representing the specific
layouts, which should be configured for the X11 keyboard.

Update the stage test case with the new option 'x11-keymap'.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-29 17:57:18 +02:00
Achilleas Koutsou
0f530b4d18 test/data/stages: tests for new stages
org.osbuild.chmod:
  - chmod the chmod binary to a-x
org.osbuild.nginx.conf
2021-06-28 19:07:42 +02:00
Achilleas Koutsou
64794b20d3 test/util_path: add basic utility function test 2021-06-28 19:07:42 +02:00
Tomas Hozza
5dc72038ef stages/chrony: extend chrony stage to allow additional directives
The `org.osbuild.chrony` stage currently supports only a single option
'timeservers' which does not allow specifying additional options for the
configured timeservers. The option can not be easily extended to allow
specifying additional options and at the same time keep the backward
compatibility with old manifests.

The need for a lower-level stage option allowing to configure additional
options of the 'server' directive is required by RHEL AMI images, which
use 'maxpoll', 'minpoll' and 'prefered' options.

Extend the `org.osbuild.chrony` stage with two additional options. The
'servers' option accepts a list of dictionaries specifying timeservers
to be configured using the 'server' directive, including a subset of the
directive options. The 'servers' option can not be used at the same time
in the stage options as the 'timeservers' option.

The second added option is 'leapsectz' corresponding with a directive of
the same name. The value of the option is a string. If the provided
string is empty, then all occurrences of the 'leapsectz' directive are
removed from the `chrony.conf`. Otherwise, the 'leapsectz' directive is
added to the `chrony.conf` with the provided value, while all original
occurrences of the option are removed.

Add a new stage test case under `test/data/stages/chrony-servers` to
test the new variant of the stage options. The reason is that the
'timeservers' option conflicts with 'servers' option, which makes it
impossible to test both of them in the same test case.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-26 10:28:03 +01:00
Tomas Hozza
e96366fb10 stages/cloud-init: add new stage for configuring cloud-init
Add new `org.osbuild.cloud-init` stage, which currently allows to create
configuration files for cloud-init under `/etc/cloud/cloud.cfg.d`. The
stage supports only a very limited subset of cloud-init configuration
options, which is covering needs of RHEL AMI images.

The schema mandates that if the 'configuration_files' option is
specified, then at least one configuration file must be defined. In
addition each section of the configuration must contain at least one
property (section or configuration option).

Add `python3-pyyaml` package to the `F34-build` testing manifest,
because it is required for running and testing the new stage.
Regenerate all affected manifests.

Add test for the new stage.

Update the `osbuild-ci` container image used for testing to a new tag,
which includes python3-pyyaml, the dependency of the new stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-24 16:55:18 +02:00
Tomas Hozza
751fd5cd28 stages/dracut.conf: add new stage for creating dracut config files
Add new `org.osbuild.dracut.conf` stage. The option
'configuration_files' allows to create dracut configuration files under
`/usr/lib/dracut/dracut.conf.d` and thus make the
configuration persistent. The stage supports only a subset of all
configuration options allowed in dracut configuration. The intention is
to provide almost functional parity with the options supported by
`org.osbuild.dracut` stage.

The schema mandates that at least one configuration file must be defined
in the stage options. In addition, each configuration file must contain
at least one configuration option.

Add test for the new stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-24 12:43:00 +02:00
Christian Kellner
a350602a77 tools/mpp: sort urls for v2 manifests
The logic to sort urls was added globally in `mpp-import-pipeline`
but only the in the v1 code path was the `state.manifest_urls`
variable set and thus for v2 the actual sorting did not happen.
Fix this and set the `manifest_urls` to the `org.osbuild.curl`
items, which makes sense because we only know how to sort those.
2021-06-22 21:10:49 +02:00