Commit graph

1959 commits

Author SHA1 Message Date
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
Martin Sehnoutka
12880950e9 spec: Improve description of the osbuild-composer package
The previous version referred to lorax-composer as the definition of
what osbuild-composer does. This worked fine while osbuild-composer was
considered an alternative for it. Now that osbuild-composer is the
default one, it should describe what it does without references to
lorax. Furthemore, composer is now able to build OSTree commits as well
as VM images, to the previous description was slightly incomplete.

This commit introduces description which is up-to-date and does not
refer to lorax any more.
2021-03-04 12:48:38 +01:00
Ondřej Budai
b28f32312d test/image: improve logging of failed osbuild execution
Previously, the test merged stderr and stderr and treated it as json. This was
obviously wrong. osbuild's stderr only returns python exception that are
of course not json.

The behaviour is now different:

1) stderr and stdout are treated separately
2) json from stdout is indented to prevent long lines. If it fails the test
   just prints the stdout as returned from osbuild.
3) stderr is printed as returned from osbuild

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-04 12:29:16 +02:00
Chloe Kaubisch
f091af55d8 cloudapi: add targetresults
Add the TargetResult struct to OSBuildJobResult. Include the 'options'
interface on TargetResult to contain target-specific information,
for example amiID and region from AWS. Expose 'options' on a status
call as an UploadStatus field. Add logic to support AWS within this
format, which can be used as a template for other targets.
2021-03-02 13:22:11 +01:00
Tomas Hozza
10ec97c2d1 tests: boot imported image as part of GCP cloudapi test
Extend the Cloud API integration test for GCP to also create a Compute
Node instance using the image, boot it and ssh to it. This brings the
GCP integration testing on par with AWS testing.

Use VHD image type for GCP integration testing, because it by default
contains `cloud-init` installed, unlike the VMDK image.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-02 10:18:08 +01:00
Tomas Hozza
6b67ca34ca schutzbot: Work around mock RHBZ#1931452 on F34
Mockbuild using systemd-nspawn currently fails on Fedora 34. The
workaround is to use "simple" isolation method - the traditional
chroot() call.

Reported as: https://bugzilla.redhat.com/show_bug.cgi?id=1931452

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-02 07:16:50 +01:00
sanne
15fa09bad2 schutzbot: Rename centos stream mock config 2021-03-01 14:48:56 +02:00
Tomas Hozza
c3efa210ac News: Add note about GCP support in Cloud API
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Tomas Hozza
bd33243012 test/README: Extend the section about integration testing
Split the integration testing section into two parts. One for testing of
Weldr API and another one for Cloud API. Cloud API integration testing
part has two sections, one for testing integration with AWS and another
one for GCP.

Fix path to osbuild-composer-cli-tests tool.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Tomas Hozza
080b64c12c cloudapi: Don't return upload type in UploadStatus for now
Upload target type is currently not returned form the worker, but
hardcoded in the cloudapi code to always return "aws". This make testing
of the cloudapi for other cloud providers quite complicated.

Since extending the target status information returned from the
worker is currently in progress, work around the situation for now
by returning an empty string as the upload type.

This will allows other types of upload targets to be tested as part of
cloudapi test case.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Tomas Hozza
31d4d4648f test: Test GCP upload as part of cloudapi test case
Refactor test/cases/api.sh to incorporate testing of cloudapi with
multiple cloud providers as the target. Since all variables in Bash are
by default global, don't declare them as empty in advance. The only
place where underclared variables can be potentially expanded are the
cleanup functions. Ensure that there are no unbound variables expanded
inside cleanup functions. Rename all AWS-specific variables to
contain "AWS_" prefix to make their purpose explicit.

Modify provision.sh to append the GCP credentials file path to the
worker configuration.

Add GCP api.sh test case to integration tests in Jenkins and run it only
if the appropriate GCP credentials environment variable is defined. Run
the GCP test case for RHEL images.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Tomas Hozza
02ad5a3199 test: Fix installation of osbuild-worker.toml in provision.sh
The tools/provision.sh script is sourced by all test cases and it sets
up the system and software for running test cases. As part of the setup,
it copied over the whole content of test/data/composer/ to
/etc/osbuild-composer. However the source directory contains not only
osbuild-composer's configuration, but also configuration for the worker.
The worker however expects its configuration in /etc/osbuild-worker.

The fact that provision.sh does not copy the worker configuration to the
correct directory didn't affect the CI, because the only test case that
relied on it is koji.sh, which copies the worker configuration
explicitly.

Move osbuild-worker test configuration to a separate 'test/data/worker/'
subdirectory. Also install the osbuild-worker test configuration to its
own subdirectory in the "-test" RPM.

Move the copying of worker configuration to the correct destination
directory from koji.sh to provision.sh, so that all test cases can rely
on the system being set up properly. Do not use wildcard for copying
osbuild-{composer,worker} configuration files, but explicitly copy each
file to its respective destination directory.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Tomas Hozza
94d399f010 cloudapi: Add support for GCP as upload target
Add support for GCP as an upload target to the internal API.

Extend the cloudapi to allow GCP as an upload target in the compose
request. Regenerate the cloudapi go code. Added GCP-specific upload
result component in the API definition, similar to AWS. It is not yet
used, but it will be once returning a target-specific result from
worker is supported.

Add support for GCP upload target to the worker job implementation.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Tomas Hozza
ff95059748 internal/upload: Add support for upload to GCP and CLI tool using it
Add new internal upload target for Google Cloud Platform and
osbuild-upload-gcp CLI tool which uses the API.

Supported features are:
- Authenticate with GCP using explicitly provided JSON credentials
  file or let the authentication be handled automatically by the
  Google cloud client library. The later is useful e.g. when the worker
  is running in GCP VM instance, which has associated permissions with
  it.
- Upload an existing image file into existing Storage bucket.
- Verify MD5 checksum of the uploaded image file against the local
  file's checksum.
- Import the uploaded image file into Compute Node as an Image.
- Delete the uploaded image file after a successful image import.
- Delete all cache files from storage created as part of the image
  import build job.
- Share the imported image with a list of specified accounts.

GCP-specific image type is not yet added, since GCP supports importing
VMDK and VHD images, which the osbuild-composer already supports.

Update go.mod, vendor/ content and SPEC file with new dependencies.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-02-25 18:44:21 +00:00
Ondřej Budai
449242ebda test/openstack: increase timeout for the instance to become ACTIVE
The openstack boot test often ruins our days with:

Waiting for instance 63ac19be-2e19-44e2-8bef-9770d68a190c to become Active
failed: A timeout occurred

I decided to investigate. It turns out the first boot of an image can take
up to 18 minutes. The subsequent ones are usually much faster (but don't rely
on this fact, I saw 15 minutes there).

This commit bumps the timeout to 30 minutes. This should be plenty of time
for the instance to spin up and get into the ACTIVE state.

Honestly, I'm not very happy with the solution but it should help with the
failing Schutzbot. As a follow up, I will reach to the PSI OpenStack team
and ask them if we could somehow speed up the process (maybe by using another
flavor, ci.m1.medium.ephemeral just might be slow for some reason, I don't
know).

Anyway, this should help us in the short term because I strongly believe that
a slow test is still better than a failing one.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-02-25 17:27:01 +00:00
Ondřej Budai
f2243151be test: remove podman-plugins workaround for RHEL/CentOS
https://bugzilla.redhat.com/show_bug.cgi?id=1877865 is now fixed and
podman-plugins is now shipped in stable RHEL. One less hack in our codebase!

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-02-25 12:14:56 +01:00
Ondřej Budai
ce23f97cb9 schutzbot: move koji-osbuild revdep test to Fedora 33
Fedora 32 will be soon EOL, let's prepare for it sooner rather than later.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-02-23 14:51:04 +01:00
Ondřej Budai
ed428879a2 schutzbot: use downstream osbuild for Fedora and RHEL 8.4
It landed in all these distros. We need to wait a bit for CentOS Stream
though.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-02-23 14:51:04 +01:00
Aleksandar Todorov
fbbdd2aa26 tests: Use full repo name to ubi8-minimal to workaround bug
/etc/containers/registries.conf.d/rhel-shortnames.conf shipped in
containers-common-1:1.2.2-1.module+el8.4.0+10073+30e5ea69 has a wrong
shortname for ubi8-minimal:

"ubi8-minimal" = "registry.access.redhat.com/repository/ubi8-minimal"

resulting in `name unknown: Repo not found` when trying to pull the image
via its short name.

Related: rhbz#1931785
2021-02-23 12:11:30 +01:00
David Rheinsberg
f794cb757e tools: move to new utility-container builds
Use the new tags of the `osbuild/containers` repository. The
infrastructure was simplified a lot and the new tags are much easier to
handle without any conflicts when building other images.

Note that this change uses the `latest` tag of all images. As an
alternative, we can also switch to the `latest-<date>` tags, which would
use a pinned immutable image tagged by the given date. However, these
tags are burried somewhere deep down in the ./tools/ directory and are
easy to forget upgrading. So for now use `latest` until we have better
synchronization infrastructure in place.

However, if these images ever break and we want to get back stable CI
behavior, we can always switch back to older builds by picking those
immutable tags instead of `latest`.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2021-02-23 09:47:17 +01:00
Tom Gundersen
5c20d45040 docs/news: describe the new saved_entry support
Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 20:01:15 +01:00
Tom Gundersen
9d477e339b test/manifets: update test cases
Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 20:01:15 +01:00
Tom Gundersen
0efc345b2d rhel84/grub2: set saved_entry
Explicitly set the kernel to boot into.

Also change the blueprint/kernenl handling:

Rather than only falling back to the default kernel name for
getting the package list, let GetKernel() always return the
correct result so we can rely on this being consistent.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 20:01:15 +01:00
Tom Gundersen
e4b9453d40 spec: update osbuild dependency
We now depend on osbuild 26.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 20:01:15 +01:00
Tom Gundersen
5f4a752158 schutzfile: pin osbuild dependency
In order to land a PR before osbuild reaches the stable repositories
we pin the verson to test against (which has been pushed out).

This is an exception from our usual procedures as we would otherwise
not be able to land this bug fix for RHEL8.4.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 20:01:15 +01:00
Tom Gundersen
a76f15648c schutzfile: test against osbuild 26 on RHEL 8.3
So we can update our production setups.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 20:01:15 +01:00
Martin Sehnoutka
8ca6b1ea15 28
Release osbuild-composer version 28
2021-02-20 17:56:23 +00:00
Tom Gundersen
f0b7cc0973 worker: keep output directory in /var/cache
Let's keep this on the same filesystem as the osbuild store, and
in particular stay away from /var/tmp and its scary semantics.

We are not aware of any issues caused by /var/tmp, but getting
rid of it means we don't have to think about that when debugging,
if nothing else.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 14:53:49 +01:00
Tom Gundersen
5ae5cdbf9e docs/news: describe addition to the weldr API
The compose endpoint gained a new `url` parameter for building
ostree-based images.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-02-20 14:53:49 +01:00
Tom Gundersen
e77483f007 test/ostree: add a second ostree test to test new features
We are gaining new ostree features that overlap to a great deal
with the current ones. We still need to keep the current features
for backwards compatibility, so add another test run that does the
same but using new API.

For now this simply uses the `url` parameter rather than `parent`
to build update commits. Further changes will be made in follow-up
commits.

Use `curl` rather than `composer-cli` as we have a chicken-and-egg
problem where we can't land this feature without tests, but
`composer-cli` can't add support for it without having it first in
`composer`.
2021-02-20 14:53:49 +01:00