Commit graph

3815 commits

Author SHA1 Message Date
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
Tomas Hozza
e30fa53c50 CI: rotate the used RHSM activation key 2022-04-07 11:44:52 +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
Gianluca Zuccarelli
5dffb9f59c cmd/worker: add empty manifest check
Implement an error case for empty manifests in the osbuild jobs.
This is already in place in the koji-osbuild job so this change
introduces the same checks in case a job receives an empty manifest
or a job has no manifest at all.
2022-04-06 21:34:02 +01:00
Jakub Rusz
a999b7b04c test/ostree-ng: remove user customization from upgrade BP
A user does not need to be specified in upgrade blueprint in order for
it to be present after the upgrade. Related rhbz#2060575
2022-04-06 16:34:31 +02:00
schutzbot
97912b43f4 Post release version bump
[skip ci]
2022-04-06 13:23:33 +00:00
Jakub Rusz
7666049210 ci: re-enabled Installer test on centos-stream-9
Anaconda with the fix released in the centos-stream-9 repos. Also fixing
ostree runner matrix.
2022-04-06 12:53:35 +02:00
dependabot[bot]
91663d5534 build(deps): bump github.com/Azure/go-autorest/autorest
Bumps [github.com/Azure/go-autorest/autorest](https://github.com/Azure/go-autorest) from 0.11.21 to 0.11.25.
- [Release notes](https://github.com/Azure/go-autorest/releases)
- [Changelog](https://github.com/Azure/go-autorest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Azure/go-autorest/compare/autorest/v0.11.21...autorest/v0.11.25)

---
updated-dependencies:
- dependency-name: github.com/Azure/go-autorest/autorest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-06 12:28:30 +02: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
Achilleas Koutsou
d3f217d40f test: (re)generate all supported installer test manifests
New test cases for RHEL 8.5.
New RPM GPG keys for RHEL 9.0.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
11be84c225 test: add RHEL 8.4 rhel-edge-installer test case
Include RHEL 8.4 rhel-edge-installer in the test cases.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
0554da5a4d distro-arch-imagetype-map: change indent to 2 spc
Change indent to match the rest of the json files in the project.
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
Xiaofeng Wang
62ab822695 test: Enable CS9 test for ostree-rebase and ostree 2022-04-06 08:59:37 +02:00
dependabot[bot]
f3141d2d71 build(deps): bump actions/setup-go from 2.1.5 to 3
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.5 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2.1.5...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-06 08:57:31 +02:00
dependabot[bot]
0756d6a76a build(deps): bump actions/checkout from 2.4.0 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-06 08:56:58 +02:00
dependabot[bot]
0c73e88cfa build(deps): bump actions/github-script from 5 to 6
Bumps [actions/github-script](https://github.com/actions/github-script) from 5 to 6.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-06 08:54:52 +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
Diaa Sami
e6475d0e0e koji: make function non-member
follow-up to PR-2397
2022-04-05 23:48:30 +02:00
Ondřej Budai
4f00081356 cloudapi/test: wait for the depsolving goroutine to finish
This allows us to use t.TempDir() everywhere. This was not possible before
because t.TempDir() fails the test if something was written in the temp dir
after the test case is finished. So by waiting on the depsolving goroutine
to finish, we can be sure that nothing is written in the tempdir anymore.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-05 09:27:43 +02:00
Ondřej Budai
fb87759aa7 cloudapi/test: properly end depsolving goroutine when cancel is called
Previously, the goroutine was never stopped because it was all the time
calling RequestJob that returned a TimeoutError.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-05 09:27:43 +02:00
Eng Zer Jun
00ea3eb285 test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-05 09:27:43 +02:00
Tomas Hozza
c9a08da29f Move rpmStageOptions() from stage_options.go to osbuild2
Deduplicate the `rpmStageOptions()` function implemented in every distro
`stage_options.go` to `osbuild2` package.

RHEL-8.4 and code using osbuild v1 manifests are not touched.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-04 13:27:42 +02:00