Commit graph

1098 commits

Author SHA1 Message Date
Brian C. Lane
b0f9d38a95 api_test: Test new source with 2nd distro 2021-07-12 08:58:42 +02:00
Brian C. Lane
f731d7a606 api_test: Test compose with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
788daf91a4 api_test: Test projects/depsolve with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
e010e2c421 api_test: Test modules/info with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
2ad4b84af6 api_test: Test projects/info with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
c9f4b1ac8b api_test: Test modules/list with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
05f327c796 api_test: Test projects/list with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
43171b4169 api_test: Test compose types with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
5021ef06f7 Add 2nd distribution to the NewTestAPI function
This will help test support for multiple distributions.
2021-07-12 08:58:42 +02:00
Brian C. Lane
c1da403dc0 weldr: Use GetAllDistroSources in allRepository* functions 2021-07-12 08:58:42 +02:00
Brian C. Lane
76e65e88c8 store: Add GetAllDistroSources function 2021-07-12 08:58:42 +02:00
Brian C. Lane
e2b170e754 weldr: Check source POST for valid distros 2021-07-12 08:58:42 +02:00
Brian C. Lane
2b56e4d8e9 store: Add Distros to Source structs 2021-07-12 08:58:42 +02:00
Brian C. Lane
f79f399808 weldr: Add optional distro selection to compose/types 2021-07-12 08:58:42 +02:00
Brian C. Lane
f233f540e5 weldr: Fix PROJECTS_ERROR response 2021-07-12 08:58:42 +02:00
Brian C. Lane
881e1c5652 weldr: Add optional distro selection to projects/depsolve route 2021-07-12 08:58:42 +02:00
Brian C. Lane
2b63b3cbed weldr: Add optional distro selection to modules and projects/info route 2021-07-12 08:58:42 +02:00
Brian C. Lane
b98cf3c4f7 weldr: Add optional distro selection to modules/list route 2021-07-12 08:58:42 +02:00
Brian C. Lane
d1d2f6d491 weldr: Add optional distro selection to projects/list route 2021-07-12 08:58:42 +02:00
Brian C. Lane
453d2dfd5f weldr: Select the distribution specific ImageType
This uses the image type based on the distribution selected by the
blueprint, or the host distro if none is present. This enables compose
to build images for the selected distribution.

It adds a helper, getImageType(), to return the ImageType based on the
distro name and compose type.
2021-07-12 08:58:42 +02:00
Brian C. Lane
dd6a7550f1 weldr: Add distribution selection allRepositories and its callers
And use it for blueprints/depsolve results.
2021-07-12 08:58:42 +02:00
Brian C. Lane
d63dd09686 weldr: Setup NewTestAPI correctly
The host distro needs to be passed to New in the first position, AND
second so that it ends up in the distro map. Without this
distros.GetDistro() will fail because it cannot lookup the host distro
name.
2021-07-12 08:58:42 +02:00
Brian C. Lane
3caa6ba24d weldr: Check blueprint POST distro or set it to host 2021-07-12 08:58:42 +02:00
Brian C. Lane
b476078570 Move isStringInSlice to common.IsStringInSlice 2021-07-12 08:58:42 +02:00
Brian C. Lane
1abdd9a1f7 weldr: Add distro field to blueprints
An optional distribution name can be included with the blueprint. If is
is not then the blueprint will be depsolved/built using the current host
distribution.

depsolveBlueprint and depsolveBlueprintForImageType check for the empty
Distro name and set it to the host distro before using it. The function
signatures have also been changed to use the value instead of a pointer
so that changes don't effect anything outside the depsolve function.
2021-07-12 08:58:42 +02:00
Brian C. Lane
aa54fe842f weldr: Add distros/list route
This returns the list of supported distributions as a list of strings.
eg.

{
    distros: ["fedora-33", "fedora-34", "fedora-35"]
}
2021-07-12 08:58:42 +02:00
Brian C. Lane
9818b4b6b1 osbuild-composer: Move InitWeldr code into weldr.New
This will make it easier to support new features related to building for
other distribution releases.
2021-07-12 08:58:42 +02:00
Brian C. Lane
a330d84739 reporegistry: Make ReposByArchName function public
This will be used to select distributions that do not match the host
distro.
2021-07-12 08:58:42 +02:00
sanne
4385c39d66 worker: Introduce heartbeats
An occupied worker checks about every 15 seconds if it's current job was
cancelled. Use this to introduce a heartbeat mechanism, where if
composer hasn't heard from the worker in 2 minutes, the job times out
and is set to fail.
2021-07-08 21:14:38 +01:00
sanne
0fcb44e617 worker: Move job tokens to the queue itself
This removes state from the worker server, as it no longer contains the
list of running jobs. Instead only the queue knows if jobs are running
or not.
2021-07-08 21:14:38 +01:00
Tomas Hozza
34d52aa8e1 osbuild2: add support for org.osbuild.authselect stage
Add support for the `org.osbuild.authselect` osbuild stage [1],
which allows one to set system identity profile and authentication
sources using `authselect`.

Add unit test cases for the newly added stage.

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
006ff98025 osbuild2: support for x11-keymap option in org.osbuild.keymap
Add support for the newly added `x11-keymap` option in the
`org.osbuild.keymap` osbuild stage [1]. The option allows one to
set layouts for the X11 keyboard.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/693

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
f06e66b94b osbuild2: support for servers option in org.osbuild.chrony
Add support for the newly added `servers` option in the
`org.osbuild.chrony` osbuild stage [1]. The option allows one to
specify timeservers to be used by chrony, including a subset of
lower-level configuration options per each server.

Implement a custom JSON marshaller method for `ChronyStageOptions` to
ensure that exactly one of 'timeservers' or 'servers' is specified, as
mandated by the stage schema.

Optional values in `ChronyConfigServer` are declared as pointers to
distinguish the case when the value was explicitly set by the user from
the default value when the structure instance is created. All of these
options should be omitted from the JSON, but only when not explicitly
set, not when their value us "0" for int or "false" for bool. Downside
of this approach is that one can not easily use pointer to a basic
type literal in the struct literal. Passing the basic type literal has
to be workarounded using an intermediate variable, which address is
used in the struct literal.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/692

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
8367542f25 osbuild2: support for subscription-manager option in org.osbuild.rhsm
Add support for the newly added `subscription-manager` option in the
`org.osbuild.rhsm` osbuild stage [1]. The option allows one to
create configure subset of subscription-manager options in its
configuration file `/etc/rhsm/rhsm.conf`.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/659

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
29ade764ce osbuild2: support for unit-dropins option in org.osbuild.systemd
Add support for the newly added `unit-dropins` option in the
`org.osbuild.systemd` osbuild stage [1]. The stage allows one to
create `.service` unit files drop-in configuration files under
`/usr/lib/systemd/system/`.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/664

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
20e1cfeba4 osbuild2: add support for org.osbuild.cloud-init stage
Add support for the `org.osbuild.cloud-init` osbuild stage [1],
which allows one to configure cloud-init by creating
configuration files under `/etc/cloud/cloud.cfg.d/`.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/689

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
9957f378ca osbuild2: support for network-scripts option in org.osbuild.sysconfig
Add support for the newly added `network-scripts` option in the
`org.osbuild.sysconfig` osbuild stage [1]. The stage allows one to
create `ifcfg` configuration files under
`/etc/sysconfig/network-scripts`.

Add unit test cases for the added functionality as well as for other
options of the stage, which were missing.

[1] https://github.com/osbuild/osbuild/pull/663

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
bef4628a08 osbuild2: add support for org.osbuild.systemd-logind stage
Add support for the `org.osbuild.systemd-logind` osbuild stage [1],
which allows one to configure systemd-logind by creating
configuration drop-ins.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/668

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
5e97dcf2b3 osbuild2: add missing JSON unmarshaling test for org.osbuild.dracut stage
The `org.osbuild.dracut` stage was previously not tested for JSON
unmarshalling. Add the missing test case and extend Stage's
`UnmarshalJSON()` method.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
92719e05a2 osbuild2: add support for org.osbuild.dracut.conf stage
Add support for the `org.osbuild.dracut.conf` osbuild stage [1], which
allows one to configure dracut by creating configuration files.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/688

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
c0e8d4bdc4 osbuild2: add support for org.osbuild.modprobe stage
Add support for the `org.osbuild.modprobe` osbuild stage [1], which
allows one to configure modprobe by creating configuration files.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/670

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
9386a02984 internal/common: add helper functions to get pointer to a basic type value
Add two new helper functions `IntToPtr()` and `BoolToPtr()` to the
`internal/common` package, which can be used to conveniently set
basic type literals in a struct literal, in which pointer to the basic
type is expected.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Ondřej Budai
385648223d spec: drop hacks for Fedora 32
There are not needed anymore, yay!

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-05 11:16:08 +02:00
Ondřej Budai
5ae6203d65 distro: drop Fedora 32
It's EOL.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-05 11:16:08 +02:00
Gianluca Zuccarelli
ea5b7e113a fix: small typo in code comments 2021-07-02 10:38:04 +02:00
Gianluca Zuccarelli
9aa8ebdfff fix: unused function arg 2021-07-02 10:38:04 +02:00
Achilleas Koutsou
5f53b3865f rhel85: append "boot" package sets to "packages"
If an image type is marked "bootable", append the package set with  name
"boot".
2021-07-01 12:48:32 +02:00
Achilleas Koutsou
e8dd5b3248 rhel85: move package sets to separate file
Package sets shared between multiple image types are statically defined
in functions.
2021-07-01 12:48:32 +02:00
Achilleas Koutsou
49df4a70af rhel85: add base build package set to distribution 2021-07-01 12:48:32 +02:00
Achilleas Koutsou
f1e805658c rhel85: distro and arch package sets
Add package sets to the top level distribution and the
architectures. Merge package sets when requested through
`imageType.PackageSets()`.
This allows us to have "cascading" package sets:
    distro > arch > image type

Previously this was only supported for the build packages. The idea is
generalised based on the idea of arbitrary package sets.

Certain package sets have special meaning (for the distro):
- packages: blueprint packages and special option packages are merged
  into this one.
- build: is not expected to be defined on the image type so it is merged
  from the distro and arch explicitly.
2021-07-01 12:48:32 +02:00