Commit graph

1888 commits

Author SHA1 Message Date
Aleksandar Todorov
661b2a0be0 Schutzbot: Allow overriding internal RHEL URL
by defining the COMPOSE_URL environment variable! This will allow
testing more flavors of internal releases.

The rest is renaming files and variables to reflect the fact that
we're running tests against internal trees, not only nightlies.
2021-03-12 20:38:06 +02:00
Aleksandar Todorov
fc2d2894d4 tests: add manifest file for CentOS 8 aarch64 AMI 2021-03-12 11:59:21 +00:00
Aleksandar Todorov
6c546fa257 Schutzbot: Start building & testing on aarch64 for RHEL/CentOS
For now we're testing only on released streams in AWS because
we don't have aarch64 support in PSI.
2021-03-12 11:59:21 +00:00
Tomas Hozza
7e6adec695 worker: refactor handling of GCP credentials
Make the handling of GCP credentials more consistent with what is being
done e.g. for Azure. Make the GCP section in worker's configuration a
pointer so that it does not show up in the printed worker's
configuration during start up if it was not specified in the actual
configuration file.

Load the GCP credentials file, if provided, during the worker start up to
prevent failure later on while processing a job with GCP upload target.
Pass the loaded GCP credentials as []byte to the OSBuildJobImpl.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-12 12:17:02 +01:00
Tomas Hozza
87d82e529d Makefile: build osbuild-upload-gcp as part of build target
Build `cmd/osbuild-upload-gcp` as part of the `build` make target,
similar to other cloud providers.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-12 12:17:02 +01:00
Tomas Hozza
53cde684d3 GCP: simplify calls to Compute Node API
Reduce the code related to Compute Node v1 API calls in a similar way as
it is done in the API usage examples.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-12 12:17:02 +01:00
Tomas Hozza
bbae190e99 worker: share GCP image only if the accounts list is not empty
Modify worker's job implementation to try to share GCP image only if the
provided list of accounts is not empty.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-12 12:17:02 +01:00
Tomas Hozza
7de2011beb GCP: refactor logging and storage cleanup
Originally, the internal GCP library in `internal/upload/gcp` was
logging various information and errors. Refactor the code to move all
logging to callers of the library. As a result, some methods now return
additional information to preserve the same amount of information being
logged for GCP.

Refactor methods to have only single purpose and not do any extra work,
such as storage cleanup. Methods which create new resources now don't do
any cleanup at all. The caller is responsible to check for any errors
and perform any cleanup necessary. Necessary methods to perform cleanup
are provided.

Modify worker's job implementation and GCP CLI tool to explicitly do all
necessary cleanup, including in case of errors.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-12 12:17:02 +01:00
Ondřej Budai
d7b0323a2d distroregistry/test: add test for GetDistro
Adding the sweet coverage.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Ondřej Budai
9bc35d5e98 distroregistry/test: make the List test generic
So we don't need to update the list when we changed the supported distros.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Ondřej Budai
e4295dc49c distroregistry/test: do not depend on the order in the List test
order of distributions doesn't matter.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Ondřej Budai
1b63a69245 distro/test: use the new default distroregistry
This way, we don't need to add here a new distro when it's added.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Ondřej Budai
a7dee8b604 distro/*: remove redundant manifest tests
The same test is run in distro/distro_test.go. The redundancy was probably
caused by a bitrot in several commits.

I decided to remove the test from distro implementations to reduce the amount
of duplicated code.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Ondřej Budai
3c715c7cf8 distroregistry: add a default distroregistry
This commit adds NewDefault() method to distroregistry that returns a slice
with all distributions supported by osbuild-composer. This way, there's only
one place where a distribution needs to be defined while its support
is being added to composer.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Ondřej Budai
dd4db353e2 distro: move Registry to its own distroregistry package
My goal is to add a method to distroregistry to return Registry with
all supported distributions. This way, all supported distributions
would be defined only on one place.

To achieve this, the Registry must live outside the distro package
because the distro implementation depends on it and this would create
a circular dependency unsupported by Go.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-12 08:29:30 +01:00
Aleksandar Todorov
b5a1d89e45 tests: Save osbuild-composer.repo file under artifacts
makes it easier to grab if we need it for manual testing or
in case one needs to download the RPMs from Schutzbot
2021-03-11 11:01:20 +02:00
Tom Gundersen
9e2e009ac8 distro: introduce PackageSets
This replaces Packages() and BuildPackages() by returning a map of
package sets, the semantics of which is up to the distro to define.

They are meant to be depsolved and the result returned back as a
map to Manifest(), with the same keys.

No functional change.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-03-10 11:52:05 +00:00
Tom Gundersen
4805eeedf8 test/data/manifests: drop .rpmmd.checksums
These are no longer used.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-03-10 11:52:05 +00:00
Christian Kellner
ee08790504 test: regenerate -cusomize manifests
Use `generate-test-cases` to generate the qcow2 image types with
customization for fedora 32, 33 and CentOS 8 and RHEL 8 and 8.4.
The previous commit changed the customization blueprint but the
changes to the resulting manifest and test data was done by hand.
2021-03-09 21:45:27 +00:00
Christian Kellner
8da813ecd2 rhel84: use en_US.UTF-8 as default for LANG
Use en_US.UTF-8 as default for LANG, which is what previously was
used and is also needed to properly work on non-us/latin setups[1].

In the customization tests, use a different value than the default
one to check that the customization does in fact work.

[1] http://git.app.eng.bos.redhat.com/git/spin-kickstarts.git/tree/rhel8/rhel-8.2-kvm-x86_64.ks#n4

Co-authored-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-03-09 21:45:27 +00:00
Tom Gundersen
130218778f test/repositories/rhel-84: update to the most recent snashot
In particular, make sure the -rt repositories and match the
base ones.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-03-09 21:39:46 +00:00
Xiaofeng Wang
0350768d73 test: Add 'kernel-rt' and kernel customization test
Since kernel upgrading from 'default' to 'rt kernel' has SSH
connection issue, 'install' kernel and 'upgrade' kernel must
have 'kernel-rt' included.
https://github.com/osbuild/osbuild-composer/issues/1222

Only RHEL 8.4 repo has 'rt kernel' repo, 'rt kernel' test will be
RHEL 8.4 only
2021-03-09 21:39:46 +00:00
Brian C. Lane
aa3e26cc10 weldr: Add tests for ostree parent and url usage
Note that this doesn't actually test for the ostree fields, I'm not sure
if that's possible with this test framework. But it does make sure that
a test compose won't try to fetch the url.
2021-03-09 16:19:44 +00:00
Brian C. Lane
aadb62f31e weldr: Add support for compose test with ostree url request 2021-03-09 16:19:44 +00:00
Chloe Kaubisch
500533116a cloudapi: single uploadrequest
Change imageRequest to accept a single uploadRequest instead of
an array of uploadRequests.
2021-03-09 16:42:33 +01:00
Ondřej Budai
d9cd9f228f worker: log target errors
This should make debugging of target uploads so much easier.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-08 18:22:27 +01:00
Ondřej Budai
ec7783324c test/azure: use eastus location
We use this location on Image Builder, let's also use it here to catch issues.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-08 18:22:27 +01:00
Tom Gundersen
167fdc44bc test/data/manifests: avoid duplicate booting
We have integration tests that boot most of the image types, let
the image tests focus on the actual content of the images, shaving
off considerable CI time.

The only missing one is OpenStack (which should be ported over) and
tar (which we need to define the integration test for).

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-03-08 13:22:26 +01:00
Tom Gundersen
59d2f505cc test/data/manifests: add trailing newline
Mostly to avoid future noisy diffs.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-03-08 13:22:26 +01:00
Achilleas Koutsou
83d87a953d test/data: regenerate existing test cases (x86_64)
A few recent changes in image type definitions haven't been reflected in
the test cases yet.  This also acts as a check to make sure that the
changes in composer don't affect the old behaviour.

Causes for (some) changes:
- Kernel modules added to package lists:
  Prior to PR #1175 image types defined the kernel package in their
  package list.  Some only included `kernel-core` and not the `kernel`
  metapackage.  Now images default to having the `kernel` metapackage
  included which also adds `kernel-modules` and `alsa-sof-firmware`.
- New package source for rt kernel.
2021-03-08 13:22:26 +01:00
Aleksandar Todorov
b1fc31060f Don't check branch name when deciding if build was started by cron
because we already have cron jobs on multiple branches!
2021-03-08 12:22:26 +02:00
Tom Gundersen
c7adc9128a Schutzbot: don't block on container build
Move the container build to the same phase as the RPM builds. This does not make a huge difference, but should
shave off about two minutes of total CI runtime.
2021-03-07 11:09:00 +01:00
Tom Gundersen
cc80957d1e schutzbot/integration/el8: add azure creds
This was left out from the EL8 test case, include the
same creds as in the other cases.
2021-03-06 15:40:48 +00:00
Tom Gundersen
271960585b internal/boot/azure: set storage account
This was lost in a refactor.
2021-03-06 15:40:48 +00:00
Tom Gundersen
b062d1070d worker/jobimpl-osbuild/azure: set storage account
This was lost in a refactor.
2021-03-06 15:40:48 +00:00
Tom Gundersen
ba40d8a1fc cmd/upload-azure: set storage account
This was lost in a refactor.
2021-03-06 15:40:48 +00:00
Ondřej Budai
a30f6bd4e6 news: add information about azure support in cloud api
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
7ae557ea22 target/azure: document what it does
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
fa9fc890c9 test: add integration test for the azure upload
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
9ca1b0a8b6 api/cloud: add support for azure
This commit adds support for uploading images directly to Azure using the
cloud API.

The UploadStatus part is currently not implemented and will be added in a
follow-up PR.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
2e39d629a9 worker: add azure image upload target
This commit adds and implements org.osbuild.azure.image target.

Let's talk about the already implemented org.osbuild.azure target firstly:
The purpose of this target is to authenticate using the Azure Storage
credentials and upload the image file as a Page Blob. Page Blob is basically
an object in storage and it cannot be directly used to launch a VM. To achieve
that, you need to define an actual Azure Image with the Page Blob attached.

For the cloud API, we would like to create an actual Azure Image that is
immediately available for new VMs. The new target accomplishes it.
To achieve this, it must use a different authentication method: Azure OAuth.
The other important difference is that currently, the credentials are stored
on the worker and not in target options. This should lead to better security
because we don't send the credentials over network. In the future, we would
like to have credential-less setup using workers in Azure with the right
IAM policies applied but this requires more investigation and is not
implemented in this commit.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
61e97372df api/cloud: remove magic constants
UploadTypes_* constants are auto-generated from the openapi spec.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
4b031a4692 upload/azure: rename azure.go to azurestorage.go
This file contains a client for Azure Storage API. As we soon introduce the
client for Azure API, we need a distinction here.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
4f66ab5d7c upload/azure: rename Image to PageBlob
The UploadImage method doesn't actually create an image. It creates a Page
Blob. Blob is something like S3 object but in the Azure terminology. Page
Blob means that's optimized for random access and it's the only blob type
that can be used to create images.

This commit cleans up the terminology so it's less confusing.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
478f69e092 upload/azure: move UploadImage under a new StorageClient struct
We will soon introduce new methods to the storage client.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
f67ca8b616 azure: return an early error if unaligned
If the image size isn't aligned to 512 bytes, the Azure API returns very hard
to understand error message. Let's do this check ourselves early so we can
return a sane error.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Xiaofeng Wang
3ed3f2ed95 test: Update dmesg test to work with only one failed log 2021-03-06 13:00:05 +00:00
Martin Sehnoutka
bb235deb62 29
Release osbuild-composer version 29
2021-03-05 15:01:38 +01:00
Tomas Hozza
15257705dd Doc: add NEWS section for Cloud API UploadStatus enhancement
Add NEWS section documenting changes done to Cloud API related to
UploadStatus.

Fix one typo in `rhel84-grub2-saved-entry.md`.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-04 15:44:04 +01:00
Tomas Hozza
319400c280 cloudapi: implement GCP target results and include UploadOptions
Return GCP-specific target results form the worker, similar as it is
done for AWS.

Extend Cloud API to allow GCP-specific upload Options.

Modify Cloud API to return UploadOptions as part of the UploadStatus.

Modify Cloud API integration test to check returned upload Options and
upload Type.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-04 15:44:04 +01:00