Commit graph

1860 commits

Author SHA1 Message Date
Tomas Hozza
db75c39c4d RHEL-86: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
5d27b7c784 RHEL-90: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
800d57fda8 Extend ImageConfig and RHEL-86/90 osPipeline
Extend `ImageConfig` and RHEL-86/90 `osPipeline` with the following
configuration options:
 - DNF Automatic configuration
 - YUM / DNF repositories
 - Firewall configuration

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
01b94a5787 RHEL-85: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline,
which creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
4ca2e64613 RHEL-86: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
b29d64c496 RHEL-90: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
9a1cb773f1 osbuild2/tar: introduce NewTarStagePipelineTreeInputs()
Introduce `NewTarStagePipelineTreeInputs()` returning a pointer to new
`TarStageInputs` structure.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
1b618b1015 osbuild2/tar: don't omit explicit false values in options
The `tar` stage options contain three boolean values. All of them
default to `true` in the osbuild stage implementation [1]. However
if these values were explicitly set to `false`, they would be omitted
from the resulting JSON structure. As a result, it was impossible to use
any non-default values.

Use `*bool` instead of `bool`, to ensure that explicitly set `false`
values will end up in the JSON structure passed to osbuild.

[1] 8102f20d23/stages/org.osbuild.tar (L39-L53)

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
cc413d4b2d osbuild2: support setting the default zone in firewall stage
Related to https://github.com/osbuild/osbuild/pull/980

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Chloe Kaubisch
296313f588 cloudapi: specify min_size type
In the filesystem object, use x-go-type to specify
uint64 as the type for the min_size field. Avoids
a type conversion in v2.go.
2022-04-14 10:03:06 +02:00
Gianluca Zuccarelli
2ad11acc2a cloudapi/test: add compose dependency error tests
Add depsolve job error dependency test cases for
regular composes and koji composes. The error furthest
up the chain should be returned in the details field
of the job error.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
e31fb36d65 cloudapi: add build job dependency checks
If an osbuild or koji-osbuild job has failed, add
a check to see if it is a result of the build jobs
dependencies and return the dependency failure job
error furthest up the chain of errors & add this
error to the details filed of the build job error.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
596464e8a2 cloudapi: fix koji build result
The incorrect result object was being used for
the kojibuild error objects.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
da94f2cbeb worker/server: build job dep errors
Add a helper function to query dependency
failures of osbuild & koji-osbuild jobs.
If a build job has a dependency error the
function will check for the job error of the
manifest job. If that also has a dependency
error the function will query the depsolve
job too for a job error.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
30d75d0e74 worker/clienterrors: depenency error check
Add a helper function to check for dependency
errors for job errors. This simply returns true
if a job error has a dependency error code and
false otherwise.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
b1969ba6a6 worker/clienterrors: omit details if empty
Omit the details field if it is null/empty.
2022-04-13 10:31:53 +02:00
Christian Kellner
e673b12957 rhel85: specify a minimum root file system size
Specify a size for the root filesystem in the partition table,
which basically equates to a minimum size. In reality all image
types specify a larger image size and thus we enlarge the root
file system to more than the specified size for plain layouts.
Does not change any existing manifests.
This also prepares the enablement of auto-LVM conversion, since
in that case we need to have a size for the root file system
specified.
2022-04-11 15:27:15 +02:00
Ondřej Budai
a3c207945f weldr: update our use of BurntSushi/toml
The old method is deprecated and failing the linter.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-08 09:45:46 +02:00
Ygal Blum
bee14bf392 OSBuild - add support for generic S3 services
jobimpl-osbuild
---------------
Add GenericS3Creds to struct
Add method to create AWS with Endpoint for Generic S3 (with its own credentials file)
Move uploading to S3 and result handling to a separate method (along with the special VMDK handling)
adjust the AWS S3 case to the new method
Implement a new case for uploading to a generic S3 service

awscloud
--------
Add wrapper methods for endpoint support
Set the endpoint to the AWS session
Set s3ForcePathStyle to true if endpoint was set

Target
------
Define a new target type for the GenericS3Target and Options
Handle unmarshaling of the target options and result for the Generic S3

Weldr
-----
Add support for only uploading to AWS S3
Define new structures for AWS S3 and Generic S3 (based on AWS S3)
Handle unmarshaling of the providers settings' upload settings

main
----
Add a section in the main config for the Generic S3 service for credentials
If provided pass the credentials file name to the osbuild job implementation

Upload Utility
--------------
Add upload-generic-s3 utility

Makefile
------
Do not fail if the bin directory already exists

Tests
-----
Add test cases for both AWS and a generic S3 server
Add a generic s3_test.sh file for both test cases and add it to the tests RPM spec
Adjust the libvirt test case script to support already created images
GitLabCI - Extend the libvirt test case to include the two new tests
2022-04-07 15:01:01 +02:00
Tomas Hozza
01880a76a2 RHEL(85+): move qemuStageOptions() from distros to osbuild2
De-duplicate the `qemuStageOptions()` implementation from many distro
implementations and move it to the `osbuild2` package as
`NewQEMUStageOptions()`.

Adjust all affected pipeline implementations.

The `NewQEMUStageOptions()` function takes an optional format-specific
options argument, instead of a dedicated format-specific options (the
previously used qcow2 compat version). This is a preparation to produce
VMDK images with a different than default subformat.

Add unit test for `NewQEMUStageOptions()`.
2022-04-07 13:48:54 +02:00
Tomas Hozza
998421d597 osbuild2: fix copy&paste error in a comment 2022-04-07 13:48:54 +02:00
Tomas Hozza
69e70dec22 osbuild2: support VMDK subformat in the QEMU stage
Support setting a specific VMDK subformat in the type format options.

The required osbuild version in the SPEC file is not bumped, since the
new functionality is currently not used by any image type.

Related to https://github.com/osbuild/osbuild/pull/999
2022-04-07 13:48:54 +02:00
Tomas Hozza
f5d70d6b58 osbuild2: add QEMU format options for vdi and vhdx
Although these format types are not used by any of the image definitions
at this moment, add them since they are supported by the osbuild stage.
2022-04-07 13:48:54 +02:00
Tomas Hozza
8697713ce8 osbuild2: rename Qcow2Options -> QCOW2Options
Make the format type options structure naming consistent.
2022-04-07 13:48:54 +02:00
Tomas Hozza
2521c18cf4 osbuild2: make QEMUFormatOptions validation an interface method
Move the validation of each structure implementing the
`QEMUFormatOptions` interface to the interface itself and to
the structures implementing it.
2022-04-07 13:48:54 +02:00
Tomas Hozza
0e512e97d2 osbuild2: use aliased type for QEMU format, instead of string
Define a new aliased type `QEMUFormat` for the format type used by the
osbuild2 QEMU stage and define constants for all allowed values.

Use QEMU format type constants in all relevant places, instead of string
literals. Not using string literals minimizes the room for making a
typo.
2022-04-07 13:48:54 +02:00
Christian Kellner
aaee939f9b distro/rhel86: enable auto-registration for azure
We want to ensure that cloud images connect to Red Hat[1] independently
of how the content was acquired (PAYG, BYOS, or marketplace).
This auto-registration feature is already enabled for AWS and this
patch enables it for Azure with the same recommended settings:

Services:
  rhsmcertd: Enabled (already done, so not changed in the patch)

/etc/rhsm/rhsm.conf:
  auto_registration: enabled
  auto_registration_interval: 60 (the default, so not explicitly set)
  manage_repos: false

The latter value `manage_repos` is left enabled (the default) in case
the user explicitly requested to have the system subscribed, i.e. the
`RHSMConfigWithSubscription` code path.

Regenerate the relevant test manifests and image information.

[1] https://cloud.redhat.com
[2] https://docs.google.com/document/d/1VeZFJxNUlyZMQJh6s3NA3RLvadqATsGxVet6uuP87_4
2022-04-06 22:40:01 +02:00
Gianluca Zuccarelli
ab98c66b9f worker/server: fix manifest-id job status
The manifest by id job status type safe function
was failing due to the jobType check which was checking
for the wrong string.
2022-04-06 21:34:02 +01:00
Gianluca Zuccarelli
b75cf30a05 worker/server: remove duplicate function
The `ManifestJobStatus` and `ManifestByIdJobStatus` both
had identical functionality. The `ManifestByIdJobStatus`
is not being referenced anywhere in the codebase and so
this function has been removed.
2022-04-06 21:34:02 +01:00
Gianluca Zuccarelli
14b006d480 worker/clienterrors: add empty packagespec error
Add an error case for an empty package spec returned
by a depsolve job and mark this with a `4xx` status.
2022-04-06 21:34:02 +01:00
Achilleas Koutsou
23d4281349 rhel84: panic if kernel not defined in installer 2022-04-06 12:09:09 +02:00
Achilleas Koutsou
a76f7a64dc distro: rename tarInstaller vars to imageInstaller
The image type is only ever known (externally) as image-installer.
Renaming the internal variables and functions to reflect the name makes
the code easier to navigate.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
8316cf7ef0 rhel85: enable anaconda users module in installers
The users anaconda module enables users to create user accounts at
install time if one is not already created in the payload.  This is
required for the cloud API (Image Builder service) for the image
installer where user customizations are not supported.  Without it, user
creation isn't possible on the installed system.

The module also enables user creation at install time through the
kickstart file for both the image-installer and the edge-installer
(Anaconda only).
Therefore, for the image-installer, the users and groups are no longer
created as part of the payload.

This commit adapts the changes from the following commits (originally
made in the RHEL 8.6 and RHEL 9.0 distros) to the rest of the RHEL
distro definitions:
ebc3330cbd
5825294dad
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
b0f7ff7c31 distro/rhel85,rhel90beta: change osPipeline() args
Pass in the image type and remove the three args (enabledServices,
disabledServices, and defaultTarget) that can be obtained from it.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
2aacd036e0 osbuild2: remove 'name' from group stage options
The name field does not exist in the osbuild schema.  This has no effect
on the current manifests.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
7236212d63 distro: deduplicate anacondaStageOptions() in RHEL pipelines
Use single NewAnacondaStageOptions() from osbuild2 instead of
implementing in each distro.

Followup from 974b0a434b, copied to the
rest of the RHEL distro definitions.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
3d53ca5d8d distro: deduplicate *kickstartStageOptions()
Use single NewKickstartStageOptions() and replace image-type-specific
implementation from each distro.
- Followup from cb186df208, copied to the
  rest of the RHEL distro definitions.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
42364f2cc6 distro: deduplicate groupStageOptions() in RHEL pipelines
Use single NewGroupsStageOptions() from osbuild1 and osbuild2 instead of
implementing in each distro.
- Followup from 2eef6e6e2d, copied to the
  rest of the RHEL distro definitions.
- Added NewGroupsStageOptions() to osbuild1 for rhel8 and rhel84.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
333bec57ef distro: deduplicate userStageOptions() in RHEL pipelines
Use single NewUsersStageOptions() from osbuild1 and osbuild2 instead of
implementing in each distro.
- Followup from ca8b371142, copied to the
  rest of the RHEL distro definitions.
- Added NewUsersStageOptions() to osbuild1 for rhel8 and rhel84.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
15243f1dc5 distro: allow user and group customizations for edge-installer
Followup from, f34380d5b5 and
3a1765a5a8, copied to the rest of the RHEL
distro definitions.

For now, these customizations have no effect on the manifest.

The new `with-users` variants of the edge-installer test cases include
the user customizations in the blueprint, but the manifests are
(currently) the same as the corresponding base cases.
2022-04-06 12:09:09 +02:00
Gianluca Zuccarelli
cc7d555fb2 worker/errors: consider dep errors as 4xx status
All dependency errors, whether they are 4xx or 5xx,
are currently being considered as a 5xx error in parent
jobs. This is causing some of the build alerts to fire
off when a depsolve job has failed, for example, when
in reality, this is an expected result. This commit
ensures that dependency errors are being reported as
4xx status in monitoring.
2022-04-06 10:57:37 +02:00
Gianluca Zuccarelli
8241e1f948 worker/clienterrors: add empty manifest error
If a manifest is empty we should have a specific error
code for that case and treat it as a 4xx error since
this would be bad input for a build job
2022-04-06 10:57:37 +02:00
Ondřej Budai
ba236180fc cloudapi: prevent dangling manifest goroutines
When composer exits, it doesn't wait for the manifest generation goroutines
to finish. This is generally a bad practice so let's introduce a bit of
syncing and a new Shutdown method to prevent this.

This also prevents the manifest generation goroutine from creating weird
states when interrupted on a random line of code.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-06 08:51:01 +02:00
Ondřej Budai
02091ba777 cloudapi: move context timeout inside manifest generator
Deduplicating the code a bit and also getting rid of the weird cancel
argument.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-06 08:51:01 +02:00
Ondřej Budai
42aa3b1f11 cloudapi: make assignment more idiomatic
Actually, my IDE is shouting at me that so changing this to make it happy.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-06 08:51:01 +02:00
Ondřej Budai
d957e1f6cc cloudapi: move enqueuing methods under server
I think it's a natural fit, they access some fields from the server so let's
find a new home for them there.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-06 08:51:01 +02:00
Ondřej Budai
a6f3dd91b6 cloudapi: split into handler and server
These "classes" are huge, let's split them into two files to make the file
smaller.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-06 08:51:01 +02:00
Diaa Sami
e773d4896b koji: fix excessive logging & monitoring
update koji init & finalize to use custom leveled logging
This is mainly affects logging, but it also changes functionality slightly
since init & finalize are now using the customCheckRetry, they are able
to retry the "TLS timeout" error.
2022-04-05 23:48:30 +02:00
Diaa Sami
7c4d74481a koji: fix excessive logging & monitoring
update koji upload to use custom leveled logging, this only affects
logging
since uploading uses a different connection to send the chunks, it is
done separately in this commit
2022-04-05 23:48:30 +02:00
Diaa Sami
ed5cd56c5a koji: promote relevant logs to Info for monitoring
Add support for promoting certain `Debug` log messages to `Info` so we
can monitor them while the logging level set to `Info`, having it set
to Debug is far too noisy.
2022-04-05 23:48:30 +02:00